1 Reply Latest reply on Oct 17, 2011 6:54 PM by John Hawkinson

    [JS][CS4] Search pages to find first application of a master spread?

    booyajamo Level 1

      I'm working on a script that searches master spreads for specific text. Once it is found, the master spread name is returned. Now I am stuck trying to search the pages to find where that master spread is first applied. Any help?

       

      var doc = app.activeDocument;
      
      app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;
      app.findChangeTextOptions.includeMasterPages = true;
      app.findTextPreferences.findWhat = "custom text";
      
      var finds = doc.findText();
      if (finds.length > 0) {
          
                var mspage = finds[0].parentTextFrames[0].parent.name;
                var dpage = doc.pages[0].appliedMaster.name; //This of course is not right, it's returning the name of the master spread for whatever page is currently selected. So how do I set the current page to the page that first uses the found master spread (mspage)?