4 Replies Latest reply on Jan 6, 2012 10:52 AM by stevewareham

    Modifying find results before calling changeGrep()

    stevewareham

      I'm trying to search through a document and find words using a specific font, and then reverse the order of the characters in those words before replacing them in the document.

       

      I'm not seeing an oppertunity though to get to modify the results of what I find though. Usually I would just call changeGrep(), but that alwasys does a "replace all". Is there not way to find the first instance of search, modify it, and then change it before going onto the next result?

       

      Here is some code I'm playing around with:

       

      //=================================\\

      app.findGrepPreferences = NothingEnum.nothing;

      app.changeGrepPreferences = NothingEnum.nothing;   

      app.findGrepPreferences.appliedFont = myFont;

       

      app.findGrepPreferences.findWhat = "\\b.+\\>";

      app.changeGrepPreferences.changeTo = "$0";

       

      myDocument.changeGrep();

       

      //=================================\\

       

      Doing this though, just results in a "change all" withing getting a chance to modify what I found first. I see that if I use findGrep() I get an array of results, that I could modify, but I don't see how I can use that to then replace the text in the document.