What Do the Default Sample Scripts Do in InDesign?
These scripts are labeled “Samples” because they were originally written as inspiration or education for people who want to learn how to write their own scripts. But even if you don’t intend to write scripts of your own, you will almost certainly find something useful in these sample scripts.
But what do they do?! Some have names that are self-explanatory, but some are quite mysterious. Here’s a quick rundown of each one:
- AddGuides. Draws guides around the currently selected object or objects. See this article.
- AddPoints. Adds points to a path: each point is added at the midpoint of each line segment in a path. (For scripters: This script demonstrates simple Bezier math and path and point manipulations.)
- AddQRCode. This script will create a QR barcode for you, but you would probably never use the script. Instead, it’s easier and faster to choose Object > Generate QR Code.
- AdjustLayout. Moves the page items of even/odd pages by specified distances. Use this script to move objects back into the correct position after adding pages or applying master pages. See this article.
- AlignToPage. How many times have you wanted to position an object in the center of the page? This script does that, and many other page alignments—including the ability to align the objects relative to the page margins. (This script is no longer necessary, since InDesign has its own “align to page/spread” feature.)
- AnimationEncylopedia. Want to see what all the different features in the Animation panel do? Just run this script. See this article.
- BreakFrame. Removes the selected text frame and its contents from the story. For example, if your story spans three frames (let’s call them A, B, and C), you can select frame B, run this script, and that part of the story will no longer be part of the thread. Doesn’t really work well when tables span multiple text frames.
- CornerEffects. Here’s another one that is no longer really relevant. Ever want to round one or two corners of a rectangle, while leaving the other corners square? If you have, then this script is for you. The script redraws the path and applies a corner effect to a pattern of corners you specify. Where the built-in InDesign feature (Object > Corner Options) makes corners that are easily changeable, the script actually adds Bezier points and curves that make it hard to edit.
- CreateCharacterStyle. When you create a character style in InDesign by basing the style on the selected text, InDesign records only those attributes that differ from the default formatting of the surrounding text. While this is a powerful and flexible way of working with character styles, it’s also different from the way that other applications (such as QuarkXPress and FrameMaker) work. In those applications, character styles apply every formatting attribute. The CreateCharacterStyle script creates a new character style based on the selected text and defines every formatting attribute.
- CropMarks. Draws crop and registration marks around the selected object or objects. You have options such as how far from the edge of the object(s) you want the marks to be positioned.
- ExportAllStories. Exports all of the stories in a document to a specified folder using the file format of your choice (RTF, tagged text, or text only). See this article.
- FindChangeByList. Runs a sequence of find/change operations on the selected text. The find/change parameters are stored in a tab-delimited text file (it should be in a folder named FindChangeSupport inside the same folder as the sample script). By default, these searches cover the standard stuff: changing double spaces to single spaces, changing double returns to single returns, changing double dashes to em dashes, and so on—but you can add your own favorite searches to the text file (including the ability to find/change formatting). You’ll find instructions at the beginning of the script, and in the corresponding find/change file. See these articles.
- ImageCatalog. Places all of the graphics in a folder in a grid in an InDesign document. See this article.
- Indic Preferences. This script is actually not in the Samples folder; it’s loose at the top level of the Scripts panel. Indic refers to languages from the Indian subcontinent. If you’re typesetting in Hindi or Bengali or something like that, you’d use this to turn on an internal setting that helps with those languages. If you don’t, then ignore it. In fact, you should specifically not run it because there is no user interface and there is no way (other than rebuilding your preferences) to reverse it. See more in the links on this podcast page.
- LabelGraphics. Adds a caption below every graphic in the document. The caption can be the file name, the file path, the XMP author name, or the XMP description. You can control the placement of the caption relative to the frame, the style used to format the caption, and the layer for the caption.
- Label Graphics Menu. Adds a menu item to the Context menu when a graphic is selected. Offers the same options as the LabelGraphics script. InDesign’s Captions feature can do much the same thing (and probably better in most cases). We also write about this here and here.
- MakeGrid. Splits the selected frame into a grid of frames. If the frame contains content, the script can duplicate the frame. See this article, and this one.
- Neon. Creates a simple “glow” effect by duplicating the selected path or paths. Each copy of the path is slightly smaller than the original, and slightly lighter. The final duplicate path is a white hairline. The resulting group of paths is something like an Illustrator blend.
- PathEffects. This script includes the ever-popular Illustrator path effects “Bloat” and “Punk,” as well as a few others. It’s crazy stuff, but can come in handy!
- PlaceMultipagePDF. InDesign can place all of the pages in a multi-page PDF, but it’s a manual process—you have to click the place icon for each PDF page you want to place. This script places all of the pages of a PDF on sequential pages, placing one PDF page per page, adding pages to the document if necessary as it does so. See this article for an even better solution.
- SelectObjects. Selects all of the objects on a spread that belong to a specific object type (or set of types). This script is only slightly useful by itself, but it shows you how to traverse the objects on a spread to find objects based on their type or content. As such, it’s a great starting point for any graphic “search and replace” operation you might want to implement.
- SortParagraphs. Alphabetically sorts the paragraphs in the selection. Shows how to sort text using a simple “bubble sort” algorithm, and how to move text in an InDesign story. See this article.
- SplitStory. Converts each text frame in the selected story to an independent text frame (story), retaining the content in the frames. Doesn’t really work when tables span multiple text frames. See this article.
- TabUtilities. This script automates several tab and indent tasks: First, you can set a right tab stop at the right margin of a paragraph. In general, I would rather use a Right Indent Tab character instead of a right-column edge tab stop. The other options are more helpful, though: You can set a left tab at the current cursor position, or adjust the left indent (or left and first line indents) based on the current cursor position. See this article.
These scripts can help you save a huge amount of time on a project. It’s worth knowing they exist so you can grab them when you need one.
Oh, I almost forgot to say how to run them… it’s easy: just double-click the script in the Scripts panel!
[Parts of this article were excerpted from Real World InDesign CS4, by Olav Martin Kvern and David Blatner.]