Copy link to clipboard
Copied
Hi there,
I am trying to apply overprint to both colours; script is;
var mydoc=app.documents.item(0);
var myOPs=mydoc.pageItems;
var myannos=mydoc.stories.everyItem().getElements();
for (i=0;i<myOPs.length;i++) {
var myOP=myOPs;
//swatch name OP
if (myOP.strokeColor.name=="Infill Magenta" | "Grid Cyan") {
myOP.overprintStroke=true;
}
else if (myOP.fillColor.name=="Infill Magenta" | "Grid Cyan") {
myOP.overprintFill=true;
}
}
for (i=0;i<myannos.length;i++) {
var myanno=myannos;
if(myanno.fillColor.name=="Infill Magenta" | "Grid Cyan") {
myanno.overprintFill=true;
}
} // appliying overprint to fill/stroke/text object.
no error message, but overprint applied only to Infill Magenta and not for Grid Cyan.
Copy link to clipboard
Copied
i think is's about the order of operations:
(myOP.strokeColor.name==("Infill Magenta" | "Grid Cyan"))
Copy link to clipboard
Copied
if (myOP.strokeColor.name=="Infill Magenta" | "Grid Cyan")
This is incorrect Javascript syntax. Look up how to use the OR operator correctly.
Copy link to clipboard
Copied
Try this:
var a1 = "yes";
if (a1 == "no" | "yes")
alert("");
and this:
var a1 = "yes";
if (a1 == "no" || a1 == "yes")
alert("");