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?
- This topic has 6 replies, 4 voices, and was last updated 5 years, 7 months ago by Anne-Marie Concepcion.
-
AuthorPosts
-
-
October 4, 2012 at 9:23 am #63295Chuck NigashMember
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.
-
October 4, 2012 at 2:47 pm #63298Theunis De JongMember
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 lineIt seems something infinitely small changed inside the Find/Change dialog, making it return just a tiny bit different result …
-
October 4, 2012 at 3:47 pm #63299Chuck NigashMember
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/2946714This 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.
-
October 5, 2012 at 1:34 am #63305Theunis De JongMember
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!
-
October 6, 2012 at 11:06 am #63307Chuck NigashMember
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. :-)
-
August 18, 2018 at 9:38 am #109879Shy SivapathamMember
@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!
-
August 25, 2018 at 8:18 am #110094Anne-Marie ConcepcionKeymaster
Shy what a wonderful testimonial! Thank you!
-
-
AuthorPosts
- You must be logged in to reply to this topic.