5 Replies Latest reply on Oct 4, 2011 11:20 AM by InDesigner of the North

    For loop stops iterating at first page

    InDesigner of the North

      I have a loop that applies a paragraph style but it stops iterating at the first page of the document.

      I need it to apply the style to the entire document...can't figure out why this isn't working.

       

      Here is my script:

       

      var myDocument = app.activeDocument;

      var myParagraphStyle = myDocument.paragraphStyles.item("Paragraph Style");

      myDocument.pages.item(0).textFrames.item(0).paragraphs.item(0).appliedParagraphStyle = myParagraphStyle;
      var  paragraphs = myDocument.pages.item(0).textFrames.item(0).paragraphs

       

      for( i = 0; i < paragraphs.length; i++)
      {
           var paragraph = paragraphs.item(i)
           
           
           paragraph.applyParagraphStyle(myParagraphStyle, true);
      }

       

       

       

       

      Thank you