InDesign/InCopy Script: Find XXs and Hyphens
Occasionally things come up at my day job (as an editor at Paizo) where I can employ my former profession as a software designer to make my life as an editor easier. A recent one involved making a script for InCopy (and thus InDesign) that finds various forms of “XX” and times when we misuse hyphens for minus signs (instead of using en-dashes, as is our house style).
(The filenames were removed intentionally, not something that the script does.)
This one searches all files open for:
- Any collection of letters that includes two more more Xs (including lowercase) in a row
- A single ‘X’ by itself; sometimes accidentally left as a times symbol instead of using the times symbol glyph
- Hyphens adjacent to numbers, disregarding whitespace characters
- Also em-dashes adjacent to numbers, just in case we’re using a font where the em-dash and en-dash look too similar
It also happens to find our ZIP+4 Code in text, but that’s not worth adjusting the script to miss.
Download the file: Find_XXs_and_hyphens.js (comes out as a .txt)
Hopefully this works for you. Admittedly, I have only tested this in InCopy CS6, so no idea how it’ll work elsewhere. But at least the code could be useful if you’re trying to make something similar. And if you have a better method for doing this, please comment!
[Edit 8/2/14 6pm: Tweaked the regex slightly to not have things like “30-foot” be false positives, so if there’s immediately a letter after the number-hyphen, it’s cool.]
I have other scripts I might post up later, but this one seems the most generally useful. This is pretty much just a fancy GREP setup, but the benefit of it might not be obvious: I can send it to coworkers and they can just click two buttons as part of a final checking process.
If you don’t know how to install and use scripts in InDesign/InCopy, check out this article: danrodney.com/scripts/directions-installingscripts.html