• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

script error;

Contributor ,
Nov 11, 2012 Nov 11, 2012

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.

TOPICS
Scripting

Views

574

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 11, 2012 Nov 11, 2012

Copy link to clipboard

Copied

i think is's about the order of operations:

(myOP.strokeColor.name==("Infill Magenta" | "Grid Cyan"))

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 12, 2012 Nov 12, 2012

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 12, 2012 Nov 12, 2012

Copy link to clipboard

Copied

LATEST

Try this:

var a1 = "yes";

if (a1 == "no" | "yes")

alert("");

and this:

var a1 = "yes";

if (a1 == "no" || a1 == "yes")

alert("");

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines