1 Reply Latest reply on Jul 21, 2009 12:01 AM by Kasyan Servetsky

    Position of Textframe with a specified text




      i have a list of ordernumbers in a textfile. Each ordernumber is separated via a Carriage return. I also have an InDesign CS4 Doc with textframes containing the ordernumbers.


      I now need to get the coordinates and pagenumber of the textframe with the ordernumber.


      The result should be a file with


      ordernumber page x y


      Can anyone help me doing it?






        • 1. Re: Position of Textframe with a specified text
          Kasyan Servetsky Level 5

          app.findTextPreferences = NothingEnum.nothing;
          app.changeTextPreferences = NothingEnum.nothing;


          app.findTextPreferences.bulletsAndNumberingListType = ListType.NUMBERED_LIST;


          var myFoundItems = app.documents.item(0).findText();


          for (i = 0; i < myFoundItems.length; i++) {
              var myParagraphs = myFoundItems[i].paragraphs;
              for (j = 0; j < myParagraphs.length; j++) {
                  var myPar = myParagraphs[j];
                  var myOrderNumber = myPar.bulletsAndNumberingResultText;
                  var myTextFrame = myPar.parentTextFrames[0];
                  var myTextFramesGB = myTextFrame.geometricBounds;
                  var myPageNumber = myTextFrame.parent.name;
                  $.writeln("Order Number = " + myOrderNumber + ", Page Number = " + myPageNumber + ", X = " +Math.round(myTextFramesGB[1]) + ", Y = " + Math.round(myTextFramesGB[0]));


          It's a very simple script that just shows you an approach that can be used for your task. I assume that text containing ordered lists in text frames that are not threaded, not inside groups, etc.

          See info written by the script into console.