4 Replies Latest reply on Aug 3, 2016 2:50 AM by selvam214

    Text scalling report

    selvam214 Level 1

      Hi All,

      I have tried to get the character scaling report from my document, I have 400 pages and can't get the report with effectively (may be very slow). Can you please help on to increase the speed based on my code?


      var myscall = [];
      var mydoc = app.activeDocument;
      var mystory = mydoc.stories;
      for(var k=0; k<mystory.length; k++){
          var mywords = mystory[k].words.everyItem().getElements();
          for(var w=0; w<mywords.length; w++){
                  myscall.push("Page No: "+mywords[w].parentTextFrames[0].parentPage.name+"\tText: "+mywords[w].contents+"\r")




      Thanks in advance,


        • 1. Re: Text scalling report
          Loic.Aigon Adobe Community Professional



          InDesign script engine is not really quick with large array of items. You may try to be less smart and use smaller chunks of data.

          That is to say looping through stories, then looping inside those stories.






          • 2. Re: Text scalling report
            Laubender Adobe Community Professional & MVP

            Hi Selva,

            I would not examine word objects, but textStyleRange objects.
            A textStyleRange would indicate changes in formatting (there are exceptions where the rendering of characters has changed, but no new textStyleRange is introduced, but that is a rare incident and will come along with complex GREP styles).


            Reason: There could be different horizontal and vertical scaled characters in one single word.


            The fastest way to get all stories would be:


            var myStoryArray = mydoc.stories.everyItem().getElements();
            var length = myStoryArray.length;


            for(var n=0;n<length;n++)
            var allTextStyleRanges = myStoryArray[n].textStyleRanges.everyItem().getElements();
            // etc.pp.


            Or directly gather all text style ranges of all stories in one go:


            var allTextStyleRanges = myDoc.stories.everyItem().textStyleRanges.everyItem().getElements();


            parentTextFrame and parentPage will not work with e.g. overset text.

            parentPage.name will also not work with text frames positioned on the pasteboard.

            And do not forget footnotes and tables if there are any.
            ( Also properties of the story object. )


            Another approach could be to first check, if a paragraph's applied paragraphStyle is overridden and then examine the textStlyeRanges in that paragraph. But that will depend of the nature of formatting that is applied to all your texts.



            • 3. Re: Text scalling report
              selvam214 Level 1

              Thank you so much Uwe. Its working fine.

              • 4. Re: Text scalling report
                selvam214 Level 1

                Thanks Loic.