Advertisement

Quick Tip: How to Batch Replace Characters and Glyphs

by

This Cyber Monday Tuts+ courses will be reduced to just $3 (usually $15). Don't miss out.

Whether you live in a non-english speaking country, or find yourself editing text for clients in other languages, you're very likely to need a quick way to add glyphs and diacritics to words in InDesign. In the following Quick Tip you will learn how.


Introduction

Suppose you receive a text document from your client which is in French, and you need to turn it into a creative design. But how about those è's, à's and the € signs? There are of course dictionaries in InDesign that do a good job spell checking and correcting words in all major languages, but what can be done when the text is in, say, Polish, or Romanian? We'll there's a more obscure tool you can use – that is InDesign's "Find Change by List" script. What this does it set up a custom dictionary as a plain text list of replace rules, using Unicode to define those characters that need to be automatically replaced. I've been using this feature quite a lot recently and I recommend you give it a try too.


Step 1

Place, or simply paste your text from the original source (usually MS Word) into InDesign. Depending on the font you are using and the patience your client had in writing the original content, all the diacritics should be in place. If that's the case, then you're done, otherwise skip to the next step.


Step 2

Open the Window > Utilities > Scripts panel and locate the "FindChangebyList.jsx" script under Samples > VBScript. Right click on it and choose "Reveal in finder" so that you find out where the source text file is located. We will be editing this text file to add replace rules that will be run by the script.


Step 3

Load the "FindChangeList.txt" file in your text editor. You will see it already has some instructions left in by the author on how to compose your rules, and a few examples which you can easily adapt to your needs.


Step 4

Add your own text or grep rules using the format described in the text file:

text {findWhat:"août"} {changeTo:"ao< U+00FB >t"} {}

Please refer to an Unicode chart table to find out the exact code you need for each glyph.


Step 5

Save the text file. Go back to InDesign, right click the script and choose "Run script". If you have a text box selected, you will get asked whether you need to run the script on the selected text box or the entire document. If nothing is selected then the script will just run on the whole document.


Step 6

Backup your text file, so you can re-use the same rules even if you re-install your system. This is especially handy for large files, the more rules you have in the dictionary, the more you'll want to save your work for future projects. I keep different versions of this text file adapted for a number of clients, and just use the appropriate source rules depending on my project.


Conclusion

Obviously no system is perfect and it takes a while to build an useful list, some people just need a couple of rules, while others need hundreds. However, once you've built your list, you just click to run the script and glyphs start popping up like magic! I hope you enjoyed this Quick Tip.

Advertisement