Skip to main content
karthikS
Inspiring
February 10, 2016
Answered

How to highlight tracking value in the java script

  • February 10, 2016
  • 1 reply
  • 1697 views

Dear friends


I have learn InDesign scripting.  I have very little experience. i want to your help.

I want to highlight for all tracking value in above +15 and -15 in the Indesign (Cs6) files.


Thanks

karthik S



This topic has been closed for replies.
Correct answer tpk1982

Hi Karthik,

Here it is...

theTextR = app.selection[0].parentStory.textStyleRanges;

try

{

app.activeDocument.colors.item("Overtracked").name;

}

catch (myError){

app.activeDocument.colors.add ({name:"Overtracked",space:ColorSpace.CMYK,colorValue:[15,100,100,0]});

}

var i=0;

while (i<theTextR.length)

{

if (theTextR.tracking <= -15 || theTextR.tracking >= 15)

{

while (i<theTextR.length && (theTextR.tracking <= -15 || theTextR.tracking >= 15))

{

theTextR.fillColor = "Overtracked";

i++;

}

} else

i++;

}

alert("The tracking value more than -15  and +15 is highlighted in Red color.");

1 reply

tpk1982
tpk1982Correct answer
Legend
February 11, 2016

Hi Karthik,

Here it is...

theTextR = app.selection[0].parentStory.textStyleRanges;

try

{

app.activeDocument.colors.item("Overtracked").name;

}

catch (myError){

app.activeDocument.colors.add ({name:"Overtracked",space:ColorSpace.CMYK,colorValue:[15,100,100,0]});

}

var i=0;

while (i<theTextR.length)

{

if (theTextR.tracking <= -15 || theTextR.tracking >= 15)

{

while (i<theTextR.length && (theTextR.tracking <= -15 || theTextR.tracking >= 15))

{

theTextR.fillColor = "Overtracked";

i++;

}

} else

i++;

}

alert("The tracking value more than -15  and +15 is highlighted in Red color.");

Legend
February 11, 2016

Hi tpk,

That is beautiful in its simplicity. I think you might be able to make it a little bit simpler. I haven't tried it, but the inner while could be removed ( I think ).

Very nice though!

P.

tpk1982
Legend
February 11, 2016

Hi Pickory,

Yeah..Good catch.. without those 'while' also script will perform as desired

Thanks for your thoughts.

Karthi