6 Replies Latest reply on Nov 22, 2016 5:34 AM by cbishop01

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

    cbishop01 Level 2

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

        • 1. Re: Show amout of characters or Text frames under certain PT size say 4PT?
          tpk1982 Level 4

          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[a].pointSize < 4)  
                  {  
                  myarray.push(mycharacter[a].length)
          //~         mycharacter[a].parentTextFrames[0].fillColor="Black"; //Turn this if you need to fill the texrframes with color
                  mycharacter[a].fillColor="Black";
                  }  
              }  
          alert("Total characters below 4 point is:\n"+myarray.length+"\n\n"+"And now it changed to Black color")
          

           

          HTH

          K

          1 person found this helpful
          • 2. Re: Show amout of characters or Text frames under certain PT size say 4PT?
            cbishop01 Level 2

            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[a].pointSize < 4)  
                    {  
                    myarray.push(mycharacter[a].length)
                    mycharacter[a].parentTextFrames[0].fillColor="Cyan"; 
                    mycharacter[a].fillColor="Cyan";
                                   
                        }else{  
                            if(mycharacter.constructor.name == "TextFrame"){  
                                if(mycharacter.fillColor.name == "Cyan"){  
                                    mycharacter.fillColor = "None";  
                }  
               }  
              }
             }
            }
            
            • 3. Re: Show amout of characters or Text frames under certain PT size say 4PT?
              tpk1982 Level 4

              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[a].pointSize < 4)    
                      {    
                      myarray.push(mycharacter[a].length)  
                      mycharacter[a].parentTextFrames[0].fillColor="Cyan";   
                      mycharacter[a].fillColor="Cyan";  
                                       
                          }else{    
                              if(mycharacter[a].constructor.name == "TextFrame"){    
                                  if(mycharacter[a].fillColor.name == "Cyan"){    
                                      mycharacter[a].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[a].pointSize < 4)  {   
                      //alert("s")
                      myarray.push(mycharacter[a].length)  
                      mycharacter[a].parentTextFrames[0].fillColor="Cyan";   
                      mycharacter[a].fillColor="Cyan";  
                      }
                      else{return;  }  
                  }  
              }
              

               

               

              HTH

              K

              1 person found this helpful
              • 4. Re: Show amout of characters or Text frames under certain PT size say 4PT?
                cbishop01 Level 2

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

                • 5. Re: Show amout of characters or Text frames under certain PT size say 4PT?
                  tpk1982 Level 4

                  HI..

                   

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

                   

                  if (mycharacter[a].pointSize <= 4)

                  • 6. Re: Show amout of characters or Text frames under certain PT size say 4PT?
                    cbishop01 Level 2

                    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[a].pointSize <= 3.9999) 
                                {      
                     myarray.push(mycharacter[a].length) 
                     mycharacter[a].parentTextFrames[0].fillColor="Cyan";     
                               // mycharacter[a].fillColor="Cyan"; 
                                                   
                     }else{      
                                        if(mycharacter[a].constructor.name == "TextFrame"){      
                     if(mycharacter[a].fillColor.name == "Cyan"){      
                     //     mycharacter[a].fillColor = "None";  
                        
                           }      
                         }      
                       }    
                     }   
                    
                            for (a=0; a<mycharacter.length; a++)      
                            {      
                                if (mycharacter[a].pointSize >= 4)      
                                {      
                     myarray.push(mycharacter[a].length) 
                     mycharacter[a].parentTextFrames[0].fillColor="None";     
                               // mycharacter[a].fillColor="None"; 
                                                   
                     }else{      
                     if(mycharacter[a].constructor.name == "TextFrame"){      
                     if(mycharacter[a].fillColor.name == "None"){      
                     //     mycharacter[a].fillColor = "None";      
                           }      
                         }      
                       }    
                     }