Skip to main content
Inspiring
November 16, 2016
Answered

Show amout of characters or Text frames under certain PT size say 4PT?

  • November 16, 2016
  • 2 replies
  • 474 views

Basically I am looking to find any text frame that the font is under 4PT.

This topic has been closed for replies.
Correct answer tpk1982

Hi.. Try this.. For now i just used Black color.. if you need use any other special color you have

var mycharacter = app.activeDocument.stories.everyItem().characters.everyItem().getElements(); 

var myarray=[]

    for (a=0; a<mycharacter.length; a++) 

    { 

        if (mycharacter.pointSize < 4) 

        { 

        myarray.push(mycharacter.length)

//~         mycharacter.parentTextFrames[0].fillColor="Black"; //Turn this if you need to fill the texrframes with color

        mycharacter.fillColor="Black";

        } 

    } 

alert("Total characters below 4 point is:\n"+myarray.length+"\n\n"+"And now it changed to Black color")

HTH

K

cbishop01Author
Inspiring
November 17, 2016

When i Try these they only half work.  It does Make the Text frame cyan.  BUt when i correct the font size to 4PT or higher and rerun the script the Text frame still stays Cyan instead of "None".

tpk1982
Legend
November 22, 2016

HI..

If you correct the font size to 4 and still got error means use like..

if (mycharacter.pointSize <= 4)

cbishop01Author
Inspiring
November 22, 2016

Thank you for all your help.  I used the below.  If the FOnt is 3.9999 or lower it turns Cyan.  And if the font is 4 or higher it makes it a None fill.

var mycharacter = app.activeDocument.stories.everyItem().characters.everyItem().getElements();     

    var myarray=[]   

        for (a=0; a<mycharacter.length; a++)     

        {     

            if (mycharacter.pointSize <= 3.9999)

            {     

myarray.push(mycharacter.length)

mycharacter.parentTextFrames[0].fillColor="Cyan";    

           // mycharacter.fillColor="Cyan";

                              

}else{     

                    if(mycharacter.constructor.name == "TextFrame"){     

if(mycharacter.fillColor.name == "Cyan"){     

//     mycharacter.fillColor = "None"; 

   

       }     

     }     

   }   

}  

        for (a=0; a<mycharacter.length; a++)     

        {     

            if (mycharacter.pointSize >= 4)     

            {     

myarray.push(mycharacter.length)

mycharacter.parentTextFrames[0].fillColor="None";    

           // mycharacter.fillColor="None";

                              

}else{     

if(mycharacter.constructor.name == "TextFrame"){     

if(mycharacter.fillColor.name == "None"){     

//     mycharacter.fillColor = "None";     

       }     

     }     

   }   

}   

tpk1982
tpk1982Correct answer
Legend
November 17, 2016

Hi.. Try this.. For now i just used Black color.. if you need use any other special color you have

var mycharacter = app.activeDocument.stories.everyItem().characters.everyItem().getElements(); 

var myarray=[]

    for (a=0; a<mycharacter.length; a++) 

    { 

        if (mycharacter.pointSize < 4) 

        { 

        myarray.push(mycharacter.length)

//~         mycharacter.parentTextFrames[0].fillColor="Black"; //Turn this if you need to fill the texrframes with color

        mycharacter.fillColor="Black";

        } 

    } 

alert("Total characters below 4 point is:\n"+myarray.length+"\n\n"+"And now it changed to Black color")

HTH

K

cbishop01Author
Inspiring
November 17, 2016