4 Replies Latest reply on May 4, 2016 3:34 AM by Loic.Aigon

    Need help with this script please.

    cbishop01 Level 2

      Hi this works kinda.   I want the Find and replace to work with the Text Frames that i have selected only.  And if possible to get the Resize text part to only resize one time.  Right now if i keep clicking the Script it keeps shrinking the text and i only want it to fit 1 time.  Then after its done maybe say "Text alredy Formatted" Also i'm not sure if i did the description right.  I want it to tell what the script is when hover over it with my mouse.  Any help will be appreciated. 

       

      //DESCRIPTION: Replace <CR> with Hard return/Resize Font to fit text frame

       

      //Replaces("<CR>", "Hard Return") 

      Replace(" <CR> ", "^p")             

       

          function Replace(input, output) 

           { 

              app.selection[0];

              app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing; 

              app.findTextPreferences.findWhat = input; 

              app.changeTextPreferences.changeTo = output; 

              app.activeDocument.changeText(); 

             

          } 

       

       

           var myTextFrame = app.selection[0];

           var myText = myTextFrame.parentStory.texts[0];

       

           do {

             

               myText.pointSize = myText.pointSize - .01;

               } while (myTextFrame.overflows == true);