is now part of CreativePro.com!

Big Problem with FindChangeByList (and an easy fix)

15

The FindChangeByList script is a marvel, and I’ve used it many times to clean up documents. For example, double-clicking this script in the Scripts panel will convert all your double-dashes to em dashes, remove multiple spaces in a row and spaces at the beginning of a paragraph, and more.

I’ve recorded a movie about it at lynda.com; Anne-Marie did one, too. And we’ve had a number of blog posts about it. But never, until today, have I realized that the default set of replacements (the FindChangeList.txt file) has a big, Big, BIG bug in it!

The Problem

If you have a paragraph that ends with a space character, and the following paragraph has a different paragraph style applied to it, then running FindChangeByList will mess up the following paragraph! It applies the first paragraph style to the second, too. For example, this:

Findchagnprob1

turns to this:

Findchagnprob2

Oooops!

The reason is that the GREP find/change in the FindChangeList.txt is wrong! Here it is:

grep {findWhat:" \r"} {changeTo:"\r"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all returns followed by a space and replace with single returns.

This is wrong in two places: the findWhat is wrong because it actually removes the carriage return (which messes up the styling); and the description at the end of the line is wrong because… well, it’s a duplicate of the previous line (someone copy and pasted by accident).

The Solution

Here’s how that line should read:

grep {findWhat:" (?=\r)"} {changeTo:""} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all returns preceded by a space and remove the space.

The findWhat code here looks for a space followed by a carriage return and just deletes it. And of course I’ve edited the description at the end of the line.

If you want to fix it on your system:

  1. Open the Scripts panel (Window > Utilities > Scripts)
  2. Open the Application/Samples/JavaScript/FindChangeSupport folders in the panel.
  3. Right-click on FindChangeList.txt in the panel and choose Reveal in Finder (or Reveal in Windows Explorer).
  4. Use a text editor (like TextWrangler… something that cannot accidentally add any formatting) to edit that file. It’s line 32.

You can save that txt file and the script should work properly now.

Sometimes those little things can make a big difference!

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, CreativePro Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at LinkedIn Learning (Lynda.com) are among the most watched InDesign training in the world.
You can find more about David at 63p.com

Follow on LinkedIn here
  • Ingo Krehl says:

    grep {findWhat:”\\x{0020}+$”} {changeTo:””}

  • Howard Candell says:

    OR, before running the script, you should try “Edit-Find\Change-GREP-Query: Remove Trailing Whitespaces”…

  • JR Boulay says:

    This bug was fixed in the French version about 2 years ago. I’d never figured that it came from the original version!
    ( https://abracadabrapdf.net/utilitaires/utilitaires-indesign/indesign-jsfindchangelist-en-version-francaise/ )

  • Alan says:

    Good catch, maestro! I realized that I’ve never encountered this one because I always run the script before I add styles/next styles, but it would have been srsly annoying if I’d used it in cleaning up something I’d inherited.

    I want a script that take a single-layer document and separates backgrounds, graphics and copy onto separate layers. People who put everything on “Layer 1” should be made to eat a 3-course meal that’s been through a blender. With extra sugar and salt. (Not that I’m bitter, you understand…)

  • Jay-Art Sadjail says:

    Thank you Sir David, now i know….thanks a lot…..

  • Aaron says:

    Wow, nice catch, David.

  • JWG says:

    I am working on InDesign tutorial “Design Newsletter”, Chapter 3(Working with text), “Cleaning up text”, where the author opens a script to clean up the text file “gardners_unclean”. He double-clicks the script to do it. When i double-click the script in my scripts panel, all i get is a beep from my PC (the kind you get when your PC warns you about something) and nothing happens. I don’t get a warning dialogue box either so i am a little stumped. I know this is something simple that i am missing, what do you think? …ID CS5.5

  • David says:

    Hello,
    It’s an old topic, but it can be useful.
    If you change the
    var myFindChangeFile = myFindFile(“/FindChangeSupport/FindChangeList.txt”) (on line 117) by var myFindChangeFile = File.openDialog(“Choose a text file”);
    You will be able to choose the .txt. So you can have as much version of the findchangebylist.txt that you want.

  • Laura says:

    Help! I’m trying to use Anne-Marie’s method of adding scripts to the FindChangeList.txt file to change paragraph styles. But my .txt file is locked and I can’t change the script! I’ve scoured the internet but I can’t seem to find anyone who has encountered this problem. Any ideas how to unlock it??

  • Anne-Marie Concepcion says:

    Hi Laura, which version of InDesign? Are you’re trying to edit the text file that the FindChangeByList script references? Are you right-clicking on that text file in the Scripts panel and choosing View in Finder/Explorer?

    • Laura says:

      Hi Anne-Marie!

      Yeah it’s the text file in the finder that I’m trying to edit (right click/View in Finder). I’m using CC 2019 version 14.0.1

      I’ve figured out a sort of workaround in that I create a duplicate, add my custom script then add it back into the folder and rename it. It seems to work but I’m worried I might break my InDesign

      Thanks for your video, it has been really helpful

      • Aaron says:

        Laura, there should be no risk of ‘breaking’ ID when doing that. In fact that’s good practice, to edit a backup and keep the (renamed or relocated) original.

  • Rajiv Arora says:

    How can I use the FindChangeByList to search and replace the case-sensitive multiple words at once.

    I use it but the case-sensitive option are not available. Suggest me the solution.

  • >