4 Replies Latest reply on Apr 11, 2013 12:07 PM by Vamitul

    Relationship between Stories and Pages

    James Ma

      Hi everyone,


      A bit of background: I am by no means an InDesign expert, but I've been tasked with pulling some text information out of our company's InDesign files to do a bit of analytics.  Each InDesign file that I'm working with has multiple pages, and each of those pages use Stories from the Master page (Forgive me if I'm using the wrong terminology, I'm working on a limited understanding of the InDesign object model).  Using the default Export All Text script as a starting point, I was able to expand that functionality to dump out other useful information; such as the geometric bounds.   I've posted some of the code below:


      myFileName = "StoryID" + myID + myExtension;
              myFilePath = myFolder + "/" + myFileName;
              myFile = new File(myFilePath);
              containers = myStory.textContainers;
              if (containers[0].overridden) {
                  for (i = 0; i < myStory.words.length; i++) {
                      myFile.write(" ");
              else {
                  myFile.write(myStory.contents + '\n');
              var geometry = containers[0].geometricBounds
              myFile.write("++" + containers[0].parent.name + '\n');
              myFile.write("$$" + geometry[0] + "\t" + geometry[1] + "\t" + geometry[2] + "\t" + geometry[3] + "\n");
              pageitems = myStory.allPageItems;
              for (j = 0; j < pageitems.length; j++){
                  myFile.write("--" + pageitems[0]);


      The question I have is, how do I determine all the pages that a Story appears in?  For example, I lets say I have 4 pages: {Master, Region 1, Region 2, Region 3}.  Region 1 - 3 all inherit a Story block from Master.  When I run this script I only get one instance of the Story block, the instance belonging to Master.  However, I would be interested to know that the Story block in question belongs to all 4 pages.  I've tried accessing the allPageItems property but I keep getting 0 results.


      Any help would be appreciated.  I'm working on InDesign CS 6 if that helps