Hi Experts,
I am new for illustrator scripting. My requirement is,
1) Select a particular layer (i used active layer)
2) Check all the objects (in active layer) stroke color with name of "Die" and that should be in spot color. (i have this Die color in swatch list already)
3) If no, then need to alert
Below is the tried codings:
var e=0; var docRef = app.activeDocument; var layers = docRef.layers; var myLayer = docRef.activeLayer; //this defines the layer that you want to get the selection from docRef.selection = null; //ensure there is nothing in the document selected already. this way you only get the selection you want. for(var i=0;i<myLayer.pathItems.length;i++){ //here we are looping through each pathItem of myLayer. var currentItem = myLayer.pathItems[i]; var findColor = app.activeDocument.swatches.getByName("Die"); currentItem.selected = true; if(currentItem.strokeColor.name != findColor.color){ e=1; } } if(e==1){ alert("Some process color used in Die"); } else{ alert("Die only used 'Die' spot color" ); }
Advance thanks,
Karthi