What's the best steps to chain GREP querries?

Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / What's the best steps to chain GREP querries?

Viewing 6 reply threads
  • Author
    Posts
    • #63295
      Chuck Nigash
      Member

      We used to have Record Find/Change years ago capture the scripting code, but under CS6 it is no longer complete (it doesnt include ChangeTo statements). We have GREP Query Manager and Chain Queries to help us execute a series of created GREPs. However, there's still something wonderful about having a user execute one script for a chained result. FindChangeByList still stands out as the best experience. …

      … the trick is knowing how to capture the code as Record Find/Change used to.

    • #63298

      Try with this modification to Martin Fischer's original “RecordFindChange.jsx”: add

      s = s.replace(/^r+/, '');

      at the 26th line, right before the comment that reads

      // column or single line

      It seems something infinitely small changed inside the Find/Change dialog, making it return just a tiny bit different result …

    • #63299
      Chuck Nigash
      Member

      OK, I'm going to try it. :-)

      As I have been pursuing chains of strings to assemble a single-script solution, I found this just a little while ago:
      https://gist.github.com/2946714

      This works as the older one used to. But that said, I'm still not out of trouble. The FindChangeByList.jsx now returns a string error here — app.doScript(myString, ScriptLanguage.javascript); — which has now thrown me into even newer confusion. The error reads: “variable name expected” and refers me to the line that I pasted here above.

      One step forward, another back. I need to come back in life as Theunis.

    • #63305

      The github script is the one I modified as well. I only tested a few simple queries, but it seems there is only one place in which it goes wrong with CS6.

      I need to come back in life as Theunis.

      Hmm :) There is barely room inside me head for one person!

    • #63307
      Chuck Nigash
      Member

      Theunis, guess what? Last night, compiling the GREP lines from Record/FindChange CS3-CS5 I found the error that was keeping the code from running. When you run a Find/Change, then run the Record script, look at the string and see that it captures it consistently like this.

      Example:

      grep {, findWhat:”~_~_~_r”} {, changeTo:”~>”}

      What has been hanging me up is the comma and space following the bracket. Once I cleaned that, the recorded string ran perfectly with FindChangeByList.

      Corrected:

      grep {findWhat:”~_~_~_r”} {changeTo:”~>”}

      Hope this helps anyone who toys with this in the future. Great to have threads that end in happiness. :-)

    • #109879

      @chuck-nigash This is many years on since you posted this correction about removing the comma and space following the bracket – I hope you see my reply – you’ve absolutely made my day !! I’ve just registered with indesignsecrets in order to send you my heartfelt thanks! Today I have been experimenting with scripts for the first time ever and without your correction I would have been put off for life! So thank you, and thank you again!

    • #110094

      Shy what a wonderful testimonial! Thank you!

Viewing 6 reply threads
  • You must be logged in to reply to this topic.
>