Skip to main content
hurix
Inspiring
June 6, 2014
Answered

Highlight the fonts applied manually

  • June 6, 2014
  • 1 reply
  • 899 views

Hi All,

If composer manually applied font, How can highlight using javascript.

Or

Instead of Sabon applied Helvetica manually how to highlight using javascript is there any possibilities.

Regards

Hurix

This topic has been closed for replies.
Correct answer Chinnadk

@Hurix, ignore the previous one and try the below.

Hi Hasvi,

Try this.

var paras = app.activeDocument.stories.everyItem().paragraphs.everyItem().getElements();

try{

     app.activeDocument.colors.add({name:"Red", model:ColorModel.process, colorValue:[15,100,100,0]});

}

catch(e){}

for(var i =0;i<paras.length;i++)

{

       for(var j =0;j<paras.words.length;j++)

       {

           if(paras.words.appliedFont.fontFamily != paras.appliedParagraphStyle.appliedFont.fontFamily)

           {

                paras.words.fillColor = app.activeDocument.swatches.item("Red");

               }

           }

    }

Regards,

Chinna

1 reply

Chinnadk
Legend
June 7, 2014

Hi Hurix,

Try this. It will apply "Red" color to the text which has font override.

var paras = app.activeDocument.stories.everyItem().paragraphs.everyItem().getElements();

app.activeDocument.colors.add({name:"Red", model:ColorModel.process, colorValue:[15,100,100,0]});

for(var i =0;i<paras.length;i++)

{

       for(var j =0;j<paras.words.length;j++)

       {

           if(paras.words.appliedFont.fullName != paras.appliedParagraphStyle.appliedFont.fullName)

           {

                paras.words.fillColor = app.activeDocument.swatches.item("Red");

               }

           }

    }

Regards,

Chinna

Inspiring
June 7, 2014

Hi chinna,

the above code is working for one or two paragraphs, if I try this to full indesign file it show error as like below:

by

hasvi

Chinnadk
ChinnadkCorrect answer
Legend
June 9, 2014

@Hurix, ignore the previous one and try the below.

Hi Hasvi,

Try this.

var paras = app.activeDocument.stories.everyItem().paragraphs.everyItem().getElements();

try{

     app.activeDocument.colors.add({name:"Red", model:ColorModel.process, colorValue:[15,100,100,0]});

}

catch(e){}

for(var i =0;i<paras.length;i++)

{

       for(var j =0;j<paras.words.length;j++)

       {

           if(paras.words.appliedFont.fontFamily != paras.appliedParagraphStyle.appliedFont.fontFamily)

           {

                paras.words.fillColor = app.activeDocument.swatches.item("Red");

               }

           }

    }

Regards,

Chinna