2 Replies Latest reply on Apr 21, 2017 11:50 PM by Laubender

    How print grep search result and use it on another search

    sohrabs6818113

      Hi

      I wanna find a pattern and then add something to that and search it again here my code

       

      app.findGrepPreferences.findWhat = "^PP[0-9]{6,6}?$";

         

          var skunumber=app.activeDocument.findGrep();

          var skupp= skunumber+"-pp"

       

       

      app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;

       

      app.findTextPreferences.findWhat = skupp;

       

      var finds = doc.findText();

       

      if (finds.length > 0) {

       

      alert("Found " + finds.length + " items, the first of them is on page " + finds[0].parentTextFrames[0].parentPage.name);

      }

      else {

      alert("Nothing has been found");

      }

       

          app.changeGrepPreferences.changeTo = finds[0].parentTextFrames[0].parentPage.name; 

       

          alert(app.activeDocument.changeGrep().length); 

           

          app.activeDocument.changeGrep(); 

       

      app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;

       

       

      but it doesn't find the    skupp ?

      how can I user the grep find value in my code?