4 Replies Latest reply on Jun 30, 2010 9:27 AM by Harbs.

    [JS CS3] Need an array of paragraphs when more than one story

    Tom Tomasko Level 1



      If I have a document with only one story the following line returns an array of all the paragraphs. I can then iterate through the array to my hearts conent.


      var paraRef = app.activeDocument.stories.everyItem().paragraphs;


      However, if there is more than one story, then, according to the Data Browser, some of the object Paragraphs contain more than one paragraph and some of the object Paragraphs are invalid. The length of paraRef is correct, i.e. it equals the total number of paragraphs in the document, but each member of this array either  "bunched up" or contains nothing.


      How can I write this so that  when I have more than one story I can get an array of all the paragraphs?