Skip to main content
Known Participant
October 19, 2020
Answered

Indesign Script for get color name or values of illustrator images used in the document

  • October 19, 2020
  • 1 reply
  • 2284 views

Hi Folks,

 

I have indesign document with placed illustrator images, indesign strokes and indesign rectangle objects. I have pull the colors of strokes, texts and rectangle objects used in the pages of the document. Is this possible to pull the color of illustrator images placed in the pages of the document.

 

This topic has been closed for replies.
Correct answer BarlaeDC

Is this possible to achieve the requirement with Adobe Bridge Concepts?


Hi,

 

Following up from my previous post here is a rough script that would list the spot colours per illustrator document. It is not very pretty the output is just IllustratorFileName, Spot Colour, Spot Colour 2, ,, IllustratorFileName2, Spot Colour 3, Spot Colour 4.

 

But it gives the idea of how to do it, and I have just used the code above provided by @rob day and wrapped it in a function that calls for each illustrator link.

 

 

//alert(checkSpots(app.activeDocument));  

// call a new function that wraps the function above
var spotsPerFile = checkSpotsPerFile ( );
alert ( spotsPerFile);


function checkSpotsPerFile (){
    var totalArray = [];
   // get all the links in the document 
    var links = app.activeDocument.links;
    for ( var j = 0 ; j < links.length; j++){
        var curLink = links[j];
        // check they are illustrator links
        if ( curLink.linkXmp.creator.indexOf("Illustrator") !== -1) {
            var newDoc = app.documents.add(false);
            newDoc.pages[0].place ( curLink.filePath);
            totalArray.push( curLink.name);
            totalArray.push ( checkSpots ( newDoc));
            newDoc.close(SaveOptions.NO);
        }
    }
    return totalArray;
}

/**
* Gets a list of spot colors from placed files 
* @Return an array of color names 
* 
*/
function checkSpots(d){
    var p=d.colors; 
    var darray = ["Black", "Cyan", "Magenta", "Yellow", "Paper", "Registration"]; 
    var placeSpots = [];
    for (var i = 0; i < p.length; i++){

        if (!checkItem(darray, p[i].name)) {
            var theName = p[i].name
            try {
                p[i].name = p[i].name + "!";
            }catch(e) {
                placeSpots.push(p[i].name)
                continue;
            }  
            p[i].name = theName
        } 
    }
    return placeSpots
}

/**
* Checks if an item is in an array
* @Param the array to check 
* @Param the item to look for 
* @Return true if the item is in the array 
* 
*/
function checkItem(a, obj) {
    for (var i = 0; i < a.length; i++) {
        if (a[i] === obj) {
            return true;
        }
    }
    return false;
}

 

 

Hope this helps

 

Malcolm

1 reply

rob day
Community Expert
Community Expert
October 19, 2020

If the AI files are placed you can get spot colors, but not process colors.

Known Participant
October 19, 2020

Yes Rob! all AI files in the spot colors. Is there any script available?

rob day
Community Expert
Community Expert
October 19, 2020

If a spot color comes in with a placed file it can’t be deleted, so a script could get a list of colors that are coming in with placed files, but I don’t see a way to find which file it came with. There might be a way to open each file and check its spot colors but that wouldn’t be a simple script.