2 Replies Latest reply on Feb 15, 2011 1:16 AM by jeanmed

    how can i show a text with findText()




      I use findText() to search a string on a existing document !


      I works when i use the lenght method it who's me the number fo item fiound.


      I want to go the page where it have been find and make  selected the text found.

      Thanks you for your help !

        • 1. Re: how can i show a text with findText()
          milligramme Level 3



          I do always this way.

          select each result and zoom, you will jump to the page.


          var doc = app.documents[0];
          app.findTextPreferences = null;
          //current zoom percentage
          var zoom_bk = app.activeWindow.zoomPercentage;
          app.findTextPreferences.findWhat = "anytext";
          //found collection
          var result = app.findText();
          for (var i=0; i < result.length; i++) {
               app.activeWindow.zoomPercentage = 400;
               //jump to each "anytext"
               alert(app.findTextPreferences.findWhat + " was found " + (i+1) + "/" + result.length);
          app.activeWindow.zoomPercentage = zoom_bk;