Members Only

Scripts for Working with Long Documents

Long document layout with InDesign presents some unique challenges. Besides the sheer volume of content, these documents are often highly structured with multiple levels of headings. They may contain highly technical content and feature lots of paragraph and character style variations. They also sometimes use InDesign’s Book panel, which has been largely untouched by the InDesign development team for many years. Thankfully, users who specialize in long documents have complained about some of InDesign’s long document shortcomings, and the vibrant community of InDesign scripters has risen to the challenge, creating some fantastic aids for working with long documents. Here are a few of my favorites.

Merge Multiple Files into a Single File

One of the more painful InDesign tasks is merging multiple files together. Perhaps you began a large project by putting each chapter in a separate InDesign file, and now you’ve decided to merge those files into a single InDesign file. Doing this manually can be tedious. But the free MergeFiles-2016 script written by Michael Zaichenko makes it much easier. The script merges all open InDesign files, all files in the open Book panel, or all the documents in a folder (Figure 1). 

Figure 1. The MergeFiles-2016 script can make short work of merging multiple InDesign files into one.

As you might imagine, merging multiple InDesign files together can be tricky business. What if two of the files have master pages with the same names but different attributes? Or what will happen to automatic chapter and page numbering? There is some guidance about how the script works in this forum discussion as well as on the script download page. The biggest problem for some types of documents is that the

script breaks threads between text frames—but the free TextStitch script from Rorohiko can make it easy to thread the frames back together. Beyond that, you’ll need to try the MergeFiles script to see if it works for you. At the very least, the script can do some of the heavy lifting for you when you need to merge multiple files into one.

Go to a Page in Any Book Document

Let’s say that you’re working on a 300-page document, with pages 1–72 in an InDesign file named Chapter_1, pages 73–198 in a file named Chapter_2, and pages 199 through the end in a file named Chapter_3. You’re using the Book feature, so all three files have been added to InDesign’s Book panel. If you choose Layout > Go to Page (or better yet, press the Command+J/Ctrl+J keyboard shortcut) and then type a page number and press Return/Enter, InDesign will “jump” directly to that page if it exists in the open, active file. But what if the page number is in one of the other files in the book? In other words, what if you have Chapter_1 open, but you want to jump directly to page 253, which is in Chapter_3? You can’t do this with InDesign’s Go to Page command. But if you download and install Peter Kahrel’s free go_to_page script, you can jump directly to any page in a book. InDesign will first look for the page number in the currently open InDesign file, and if it doesn’t find the number there, it will look in the files in the book panel to locate the page number, opening the appropriate InDesign file as necessary (Figure 2).

Figure 2. Peter Kahrel’s go_to_page script operates just like InDesign’s Layout > Go to Page command, except that it will look for a matching page number in all the files in the Book panel.

I recommend that you use the Edit > Keyboard Shortcuts command to reassign the Command+J/Ctrl+J shortcut to the script, replacing the Layout > Go to Page shortcut.

Export Book Documents to Individual PDFs

InDesign’s Book panel is a good way to “join” multiple InDesign files into a larger document. But a shortcoming for some workflows is that the Book panel only offers a single Export Book to PDF command. There isn’t an automatic way to create a PDF of each InDesign file in the book. Peter Kahrel’s free pdf_individuals script is a good way to do this. The script will not only let you export each file in a book to its own PDF, but it also gives you the option to output the entire book as individual single page PDFs, or to break the book into multiple PDF files based on sections within each document (Figure 3).

Figure 3. Peter Kahrel’s pdf_individuals script offers many options for outputting an entire book to PDF.

Process Large Batches of Files

Another script that I’ve found useful when a project consists of many separate InDesign files is the free Batch processor script by Kasyan Servetsky. This script lets you run any other script, or a sequence of scripts, on an entire InDesign book or a folder of files. Kasyan even includes a few simple scripts on his website that are written specifically to work with the Batch processor script. These scripts are easy to edit so that they work the way you want them to. You don’t really need to know anything about scripting—you just need to be willing to fiddle with the text and go through some trial and error. For example, let’s say that you need to hide a layer named “Spanish text” on every InDesign file in a specific folder. Here’s how you could do that.

  1. Download the Batch processor script and install it. 
  2. Visit Kasyan’s “scripts for batch processor” page and download the Make layer invisible-visible script. 
  3. Open the Make layer invisible-visible script in any text processor. You’ll see a line that contains the name Layer 1 in quotes. 
  4. Change Layer 1 to the name of your layer (“Spanish text” in this example), being careful not to change the quote marks to “curly” quotes. 
  5. Save the file as a plain text file with the .jsx extension. 
  6. Follow Kasyan’s instructions to run the Make layer invisible-visible script with the Batch processor script (Figure 4).

Figure 4. The Batch processor script gives you lots of options for running scripts on a book or on an entire folder of InDesign files.

Yes, this takes some setup, trial and error, and fiddling around, but it can potentially save hours of work (and your sanity) on a large project. Of course, you can run other scripts besides Kasyan’s with the Batch processor script, but these are a good starting point.

Automatically Apply Master Pages

The Mastermatic script by id-extras ($57) adds a unique capability to InDesign. It lets you create rules that specify which master page is applied to which document page, based on what paragraph styles or object styles appear on that document page. For example, you might want a “ChapterOpen” master page applied wherever the paragraph style “Chapter Title” is found. Once the rules have been defined, the master page assignments change dynamically as you work (Figure 5). This script isn’t free, but it is simple to use, well documented, and well supported by the developer. It’s worth every penny if you create long documents where the master page assignments follow some sort of rules based on paragraph or object styles.

Figure 5. Mastermatic allows you to set up simple rules to assign master pages to document pages automatically.

Find/Change in Paragraph Styles

In my experience, the longer the document, and the more individuals that work on it, the longer the Paragraph Styles panel gets. Now imagine that you are tasked with changing the typeface used in all of heading and subhead styles in such a document. Or finding which styles are 90% black and changing them to 80% black. Examining styles one by one can be really tedious. But the Search in Styles script from id-extras ($49) adds the ability to perform any type of search you can do in InDesign’s Find/Change dialog box, but on the attributes (or names) of your paragraph styles (Figure 6). See this InDesignSecrets blog post for more information about how the script works.

Figure 6. The powerful Search in Styles script lets you quickly find and change attributes in paragraph styles.

Show Which Paragraph Styles Are Based on Others

Imagine that you have a huge document that contains lots of paragraph styles, and you need to make a change to one of the styles. You want to make a precise, surgical change so that you don’t mess up the document, but you fear that there might be other paragraph styles based on the style you want to change. Unfortunately, InDesign offers no visual cue in the Paragraph Styles panel to help you determine which styles are based on other styles. But the free Show Paragraph Based-On script from in-tools is really helpful for this. When you run the script, it examines all your paragraph styles and presents them in an outline view that shows which styles are based on other styles (Figure 7).

Figure 7. In this example, the Show Paragraph Based-On script shows that a change to the “Head 1” style will also change the “H1 new column” and “New page heading” styles.

Highlight Text with the No Break Attribute

The No Break command in the Character panel menu is a good way to keep web addresses and other important text on a single line and to control line breaking without using returns or a forced line break character. The downside, however, is that you can’t easily tell where this attribute has been applied in a document. Peter Kahrel’s free show_nobreak script takes care of this. The script applies a light purple highlight to every occurrence of text with the No Break attribute. The script uses conditional text to do the highlighting. To remove the highlighting, just delete the nobreak condition created by the script in the Conditional Text panel. (Figure 8).

Figure 8. The show_nobreak script uses conditional text to apply an easy-to-see highlight to text with the No Break attribute.

Effortlessly Find Word Stacks

It is particularly soul-sucking to finish and submit a long, complex layout in InDesign, and get it back from the client marked up with dozens and dozens of line endings that need to be corrected because of “word stacks” (lines that contain the same word in the same horizontal location as the line above or below). These are particularly common in how-to books, technical guides, and documentation, as the same words and phrases tend to repeat over and over again in this type of content. The free SmokeWordStacks script from Rorohiko makes short work of scanning through a long document and identifying not only word stacks, but also hyphenation stacks and a couple of other related issues. When you run the script, you choose what type of “stacks” to look for (Figure 9). Then, the script quickly highlights each stack with a character style. The character style defaults to a red underline, making the stacks easy to see visually, or you can use Find/Change to locate every occurrence of the character style. The behavior of the script can be fine-tuned to your requirements with an easy-to-edit configuration file included with the script.

Figure 9. The SmokeWordStacks script makes quick identification of word stacks and related text problems in a long document easy.

Quickly and Accurately Clean Up Text

There are many scripts available for cleaning up text. But I really like the free Text Cleanup script from Mars Premedia. This script lets you fix all the usual text “nasties” that you might encounter when you first import a text file into your InDesign document, such as sequential tabs, paragraphs indented with tabs, leading or trailing spaces, double hyphens, and much more (Figure 10). What makes this script unique is that it automatically shows hidden characters, zooms in on each occurrence of the found text, and then gives you several options for previewing or making the change (Figure 11). I find this “semi-automatic” approach to cleaning up the text to be really accurate and useful.

Figure 10. The Text Cleanup script offers numerous options for fixing imported text.

Figure 11. The Text Cleanup script lets you confirm (preview) each change, OK changes individually, or accept all changes of a specific type.

Show Your Scripters Some Love!

As you download the free scripts in this article, you’ll see that many of the scripters accept donations for their work. If a script saves you time, do the right thing and send a contribution. These scripts represent countless hours of development time, and believe me, scripters don’t get rich off of these. Most scripters earn a living working other jobs or working on paid scripting projects for clients. They release these scripts out of the goodness of their hearts. Rewarding them will encourage them to continue to do so!

More Resources To Master InDesign

The InDesign Conference is coming to a screen near you—hosted entirely online, December 9–12, 2025.

Join the world’s most knowledgeable InDesign experts as they share their wisdom, tips, and techniques for building documents of every size and format.

LEARN MORE

Members get a special discount on registration! Sign up today.

Bookmark
Please login to bookmark Close

Not a member yet?

Get unlimited access to articles and member-only resources with a CreativePro membership.

Become a Member

Comments (1)

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Michael W. Perry

    I can give one of the most important of long-document tips—use paragraph and character styles for everything. You can get away with making manual changes in an advertising brochure. You can’t in a 400-page book.