4 Replies Latest reply on Feb 6, 2010 4:22 AM by AdobeScripts

    Find content in Indesign by box position

    gopaljay78 Level 1



      I am writing a Javascript to find specified text in Indesign page. For example, the text should be like in this format "{{artref art1}}".


      In Indesign file, this text is placed in the below format.

      A Page in Indesign have 4 text frames. In each text frame, this text is present.

      For example, Top text frame contains  "{{artref art1}}", next contains "{{artref art2}}", next contains "{{artref art3}}", and last one contains "{{artref art4}}".

      Actually, I want to find the text  in the box order. But my script find the text in  box creation order.

      That is "{{artref art1}}", "{{artref art4}}", "{{artref art3}}", "{{artref art2}}".


      Below is my script:


          app.findGrepPreferences = null;
          app.findGrepPreferences.findWhat = "\\{\\{(artref) (.+)( ?)(.+)?\\}\\}";


          found = app.activeDocument.findGrep (false);
          for (i = 0; i<found.length; i++)
              var y = found[i].parentTextFrames[0].parent.name.toString();  // to find page number
              alert (y + " " + found[i].contents);



      Could anybody help  me to find the text in box position order.


      Thanks in advance.