3 Replies Latest reply on Jul 21, 2010 1:49 AM by Peter Kahrel

    ChageGrep Script Not Working in IDCS3

    Jeff Sese Level 1

      I have a simple snippet that should do a GrepChange but it seems that it fails to find the target text. Also, when I try to do the search via the UI, it also fails to find the target text. Is there a documented bug about grep searching in InDesign CS3?

       

      Here is the script:

       

       

      app.findChangeGrepOptions = NothingEnum.nothing;

      app.findGrepPreferences = NothingEnum.nothing;

      app.changeGrepPreferences = NothingEnum.nothing;

      app.findGrepPreferences.findWhat = "^(anthropology)$";

      app.changeGrepPreferences.changeTo = "".concat("$1\\t2123");

      app.findChangeGrepOptions.includeFootnotes = false;

      app.findChangeGrepOptions.includeHiddenLayers = false;

      app.findChangeGrepOptions.includeMasterPages = false;

      app.findChangeGrepOptions.includeLockedStoriesForFind = false;

      app.findChangeGrepOptions.includeLockedLayersForFind = false;

       

      var results = app.activeDocument.selection[0].parentStory.findGrep(false);

      if (results.length == 0) {

      $.writeln("ID not found.");

      }

      I have InDesign v 5.0.4.

       

      The script runs perfectly in CS4.

       

      Thanks in advance,

      -- Jeff