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

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

Advocate ,
Nov 16, 2016 Nov 16, 2016

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

345

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

correct answers 1 Correct answer

Guide , Nov 16, 2016 Nov 16, 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";

...

Votes

Translate

Translate
Guide ,
Nov 16, 2016 Nov 16, 2016

Copy link to clipboard

Copied

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

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
Advocate ,
Nov 17, 2016 Nov 17, 2016

Copy link to clipboard

Copied

Yes this works.  Thank you..  I've tried to modify this to get rid of the Fill after the font is fixed and its not working.  Can you See what i've done wrong?

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="Cyan";

        mycharacter.fillColor="Cyan";

                      

            }else{ 

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

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

                        mycharacter.fillColor = "None"; 

    } 

   } 

  }

}

}

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
Guide ,
Nov 17, 2016 Nov 17, 2016

Copy link to clipboard

Copied

You forgot to include loop increment..

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="Cyan";  

        mycharacter.fillColor="Cyan"; 

                        

            }else{   

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

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

                        mycharacter.fillColor = "None";   

    }   

   }   

  } 

}

this also works..

mypointsize();

function mypointsize(){

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

var myarray=[] 

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

    {   

        if (mycharacter.pointSize < 4)  {  

        //alert("s")

        myarray.push(mycharacter.length) 

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

        mycharacter.fillColor="Cyan"; 

        }

        else{return;  } 

    } 

}

HTH

K

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
Advocate ,
Nov 17, 2016 Nov 17, 2016

Copy link to clipboard

Copied

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".

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
Guide ,
Nov 21, 2016 Nov 21, 2016

Copy link to clipboard

Copied

HI..

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

if (mycharacter.pointSize <= 4)

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
Advocate ,
Nov 22, 2016 Nov 22, 2016

Copy link to clipboard

Copied

LATEST

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";     

       }     

     }     

   }   

}   

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