is now part of!

A Script to Flag Certain Words in InDesign


If you’ve ever worked on a project where it was important that certain words not be used, you might be interested to know there’s a script that can flag those words, highlighting them in the InDesign layout so you can spot them easily and remove/replace them.

The script is by Peter Kahrel, who was inspired to write it by this forum post.

If you know about GREP styles, you might be thinking they would also work for this kind of thing, and that’s true. You could make a GREP style that flagged all the “risk” words by automatically formatting them with a character style. But GREP styles can get unwieldy when you make them search for lots of stuff. Imagine you had a list of 50 words you needed to flag. The GREP style to do that would be a pain to set up and edit, and it could slow InDesign down significantly, especially in long documents.

Peter’s script uses text conditions instead of GREP. You simply put all your risk words into a plain text file, named “risk-words.txt” in the same folder as the document.

Run the script and it will find all instances of those words and apply a text condition called Risk Word to them.

Another advantage conditional text has over a GREP style is that the conditional formatting won’t appear in any output unless you want it to. By default, it will only be visible in the layout. But you can make it appear in output by opening the Conditional Text panel (Window > Type & Tables > Conditional Text), and choosing Show and Print from the Indicators menu in the panel.

You can also quickly toggle the visibility of the conditional formatting in the layout by choosing Hide from that same menu. You could even assign keyboard shortcuts to those menu choices to really speed things up!

GREP styles are not so easy to turn on and off, and if you used one, you’d have to remember turn it off before you exported or printed the document.

Don’t like default yellow highlighting for the condition indicator? Double-click the condition in the panel to open the Condition Options dialog box. There, you can change its name, choose from various underline styles and colors.

You can download the Flag Risk Words script here.

Editor in Chief of CreativePro. Instructor at LinkedIn Learning with courses on InDesign, Illustrator, Photoshop, GIMP, Inkscape, and Affinity Publisher.
  • Candi Crosson says:

    Thank you Mike! And thank you, Peter for taking the time to write this script. Since this article, Peter has updated the script (see forum post link in article). Before, it flagged a “risk word” inside of a full word (i.e. ‘all’ within ‘allow’ etc.) and if a word was removed from the list, that word remained highlighted (both are fixed). Now, I look forward to sharing this with my team.

  • Angel Elbaz says:

    Thank you, very interesting.

  • Brenda Eggert says:

    I no longer wonder if the internet is reading my mind. For the first time ever just this morning, I was working on a job where I thought “it sure would be nice if I could flag certain words just so that I could locate them in my job, but not print the highlighting”. Within 30 minutes, the email arrived with this article! I was so excited. I immediately downloaded the script and tried to use it. However, even though I have the .txt file set up and in my job folder, the script says it can’t locate any words, even though I set up a test paragraph. Any ideas what I might be missing?

    • Mike Rankin says:

      I just tested it and it worked as expected with InDesign 2023. Make sure your text file is named risk-words.txt and saved in the same folder as the INDD. And make sure the INDD is saved before running the script. It also won’t work if the text frame or layer is locked.

      • SM says:

        I downloaded the file and tried to add the jsx to the script folder in INDD and requested my IT approve the installation. We keep getting this message.
        Error code 0x80004005. This problem may occur if a file that the Windows Product Activation (WPA) requires is damaged or missing. This behavior occurs if one or both of the following conditions are true:
        – a third-party backup utility or antivirus program interferes with the installation of Windows XP
        – a file that WPA requires is manually modified.

        The file looks like it was created 8/1/2023 – am I grabbing the correct download? I am dropping it here: Program FilesAdobeAdobe InDesign 2024ScriptsScripts Panel

        My IT guy thought it might be a conflict if it was written for an older version of INDD. I did drop it in the current working version, not the beta or prerelease.

        I’m sure I’m doing something wrong here, but I’m not sure what, and this script will be great for what I’m working on.

  • >
    Notice: We use cookies on our websites to give you a great online experience. If you keep browsing, we'll assume you're ok with this. For more information, see our privacy policy. By closing this banner, you agree to the use of cookies.I AGREENo