0 Replies Latest reply on Oct 14, 2015 1:54 AM by georgep3262015

    Text Frame - reduce text size to fit on one line


      I already have code that does what i want it to do, but i need it to search through all text frame automatically rather than me having to manually go through all text frames and highlight the text i want to reduce the size of. Is there any way to overcome this problem.


      My code so far:


      var myDoc = app.activeDocument;



           var mytextFrame = myDoc.selection[0];

           if (myDoc.selection.length == 1)


                     var myLines = mytextFrame.lines           

                     var minimumSize = 4; // minimum; 

                     var reduceSize = -0.5;

                     var myRange;



                     while (myLines.length >1){

                         for (i=0; i<mytextFrame.textStyleRanges.length; i++){ 

                          myRange = mytextFrame.textStyleRanges[i]; 


                          if (myRange.pointSize<minimumSize){ 

                              throw ("Text too small.");             











      else {

          alert ("No text frame is selected");