Copy link to clipboard
Copied
Is there a way to compare a pathItems swatch color? For example I have a layer named "032 Red" if the pathItem on this layer does NOT have a swatch color named "032 Red" alert the user there is a problem. If everything is ok alert the user that it is all good.
#target illustrator
var doc = app.activeDocument;
var allLayers = doc.layers;
var allLines = doc.pathItems;
var allSwatches = doc.swatches;
var redSwatch = allSwatches['032 Red'].color;
else if (allLines.layer == "[Layer 032 Red]"){
if(allLines.strokeColor != redSwatch){
alert("Error on layer 032 Red");
}
else{
alert("032 Red layer is good");
}
}
That is just a snippet of my code but if anyone can help with that I would appreciate it!
Figured it out!
else if (allLines.layer == "[Layer 032 Red") {
if (allLines.strokeColor.spot != "[Spot 032 Red]") {
alert("Error on layer 032 Red");
} else {
alert("032 layer is good");
}
}
Copy link to clipboard
Copied
Figured it out!
else if (allLines.layer == "[Layer 032 Red") {
if (allLines.strokeColor.spot != "[Spot 032 Red]") {
alert("Error on layer 032 Red");
} else {
alert("032 layer is good");
}
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now