1 Reply Latest reply on May 7, 2013 9:00 AM by Trevorׅ

    Finding the right variable for "All" text.

    Brett Anders

      So far, I'm a copy/paste javascripter and this one script has troubled me. These following formatting techniques I wanted to automate to adjust the copy in my documents, and it has worked until I tried it on a document that already contains "Paragraph Styles".

       

      How can I refer to all text (regardless of Paragraph & Character Styles) in the document, rather than using  the variable "allParagraphStyles". Ultimately I'd like to also, incorporate the change to text frame with a direct selection otherwise highlighted copy, else / document wide.

       

      Any help would be greatly appreciated!

       

      var myDoc = app.activeDocument;

      myParagraphs = myDoc.allParagraphStyles;

      for(var i=1; i<myParagraphs.length; i++)

      {

              myParagraphs[i].maximumWordSpacing = 151;

              myParagraphs[i].desiredWordSpacing = 150;

              myParagraphs[i].minimumWordSpacing =  120;

              myParagraphs[i].maximumLetterSpacing = 500;

              myParagraphs[i].desiredLetterSpacing = 0;

              myParagraphs[i].minimumLetterSpacing = 0;

              myParagraphs[i].maximumGlyphScaling = 130;

              myParagraphs[i].desiredGlyphScaling = 130;

              myParagraphs[i].minimumGlyphScaling = 50;

              myParagraphs[i].tracking=0;

              myParagraphs[i].horizontalScale = 75;

              myParagraphs[i].hyphenation = false;

              myParagraphs[i].composer="Adobe Single-line Composer";

              myParagraphs[i].noBreak = true;    

      }

        • 1. Re: Finding the right variable for "All" text.
          Trevorׅ Adobe Community Professional

          Just copy and paste this

           

          myTexts = app.activeDocument.stories.everyItem().texts[0]; // to change only the selection this line to change to:      myTexts = app.selection[0]; 
          myTexts.maximumWordSpacing = 151;
          myTexts.desiredWordSpacing = 150;
          myTexts.minimumWordSpacing =120;
          myTexts.maximumLetterSpacing = 500;
          myTexts.desiredLetterSpacing = 0;
          myTexts.minimumLetterSpacing = 0;
          myTexts.maximumGlyphScaling = 130;
          myTexts.desiredGlyphScaling = 130;
          myTexts.minimumGlyphScaling = 50; 
          myTexts.tracking=0;
          myTexts.horizontalScale = 75;
          myTexts.hyphenation = false;
          myTexts.composer="Adobe Single-line Composer";
          myTexts.noBreak = true;