Recently on the Adobe Forums, I have responded to several posts from fellow users wondering how to “chain” find and change or GREP searches so that they are performed all at once rather than one at a time. It is possible to do but it is hardly documented anywhere, and needs a significant amount of tweaking and a basic knowledge of a text editor and reading code before it is of any real use.
“Chaining” searches has many advantages. For example, where a document has many double spaces, double returns, etc, normally each find/change would need to be run one after another. If chained together, the search need only be performed once. This is ideal for formatting text with inconsistent spacing.
To users out there who just want a “quick fix” and a better solution, there are two external links to point to:
- The first is a text cleaner by Keith Gilbert and is Mac only and can be found here.
- The second is a proprietary plug-in which is mentioned in other posts on this site but is not only great; but how i feel the actual InDesign software should have been shipped. It is called Multi Find/Change and is written by Automatication and can be found here.
For users either not prepared to spend a cent and/or wanting to get their hands dirty, read on…
In Adobe InDesign, there is a script which ships with adobe indesign called findchangebylist.jsx. There is also a subfolder in the script folder called FindChangeSupport.
What findchangebylist.jsx does is it loops many find/greps together by referencing a text file of the changes which is in the FindChangeSupport folder. This text file is called FindChangeList.txt. If this is opened up in textedit, notepad, textwrangler, whatever text editor of your choice, find/grep searches are listed here. It’s all pretty cody though.
However, if you go to the FindChangeSupport folder and change the name of this FindChangeList.txt to FindChangeList2.txt for example and then run the findchangebylist.jsx, the script does not run. Instead, a dialog box asks which file to open. From here, you can then navigate to the FindChangeList2.txt file and open it.
At work, I have several different text files which each contain various finds/greps which i may need to run for different projects, and they are named Yearbookfix.txt or businesscardfix.txt etc, and then i run the findchangebylist.jsx and then navigate to whatever file i need to run.
Sadly as i’ve said before, it is all fairly cody. Here is an example of one line of a find/change routine line in one of the scripts which I use at work:
grep {findWhat:”\\s\\r”} {changeTo:”\\r”} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
In simple english, this line tells the find/change to behave as a GREP, and to look for any space followed by paragraph return and to change it to a paragraph return only. It is also telling the GREP to search footnotes, master pages and hidden layers.
But for me to add a new search parameter to this textfile without really knowing how to write the code is quite daunting.
Luckily, there is another script which effectively takes a change made in the find/change dialog box and writes the code for you. It is called RecordFindChange_CS3-CS5.jsx and is written by Kasyan Servetsky.
The way this script works is you would type in the find/grep which you want in the find/change dialog box, and once it is typed into the dialog box and ready to search, run the RecordFindChange_CS3-CS5.jsx. Within moments, a textfile will appear with the pre-coded form of the find/grep which can then be cut and added to the txt file containing your customised find/greps.
In terms of learning more about the power of GREP searches, go to the indesignsecrets.com GREP portion of their website. Otherwise, theindesigner.com‘s Michael Murphy has some excellent resources.
[…] http://colecandoo.wordpress.com/2011/08/25/make-findchange-behave-more-like-a-word-macro/ […]