How to Install a Script in InDesign That You Found in a Forum or Blog Post
This has bugged novice InDesign users for years: You find a script on a forum thread or a blog post, but it’s just text… that is the scripter has pasted the text of the script in, so you can actually see the code. For experienced users (and scripters), that’s no big deal. But if you want to use that script, but you don’t know what to do with the code, read on.
Okay, you see a bunch of code and you want to run it in InDesign.
1. Copy the Script. You need to copy the text. On some web pages, there will be a “Select Code” button for your convenience (just click it and it selects all the code). Otherwise, just drag over the code text and copy it to the clipboard. Make sure you get it all — dropping even a single character can often mean the difference between success and failure.
2. Paste the Script. You need to save the script into a text-only file. You could paste the code into the Adobe Extendscript Toolkit application, but that’s overkill unless you’re planning on doing scripting yourself. Instead, paste it into a text-editor, such as TextWrangler (my favorite free text editor for the Mac), or TextEdit, or NotePad on Windows. Just make sure that you’re in text-only mode, so there’s no formatting (font, styles, and so on).
3. Save the Script. When you save the script to disk, it must have a .jsx file name extension (not .txt). You can save it to disk anywhere you want, such as the Desktop, My Documents, or some other folder.
4. Move the Script into Position. In order for InDesign to see and use the script, it has to be in one of two places. To find that “right place,” switch back to InDesign temporarily and open the Scripts panel (it’ll be in the Window menu; in CS5 or later, it’s tucked in the Utilities submenu). You’ll see two folders listed in the Script panel: Application and User. I almost always store my scripts in the User folder because they’re “my” scripts. So right-click (or Control-click with a one-button mouse) on the User folder and choose Reveal in Finder from the Context menu (or Reveal in Explorer in Window). That opens a folder on your desktop in which you’ll find a folder called Scripts Panel. Move your script into the Scripts Panel folder. Any script inside the Scripts Panel folder will appear in the Scripts panel.
5. Run the Script. That’s it! Now you can switch back to InDesign and you should see your newly-saved script inside the User folder. (You may have to click the expanding triangle next to the folder name to see it.) You can run it by double-clicking it.
If the script doesn’t work for some reason, go back to the file and:
- make sure it’s truly a text-only file
- make sure any quotation marks (single or double) are straight quotes and haven’t accidentally been turned to curly quotes
- make sure you copied all the script properly
- make sure you’re running the script properly (for example, some scripts require a frame to be selected before they do anything; others need a document open, or no documents open, and so on).
- in some cases, part of the script will have been messed up by the web site formatting. For example, some characters may have been munged, deleted, or changed in the HTML. In this case, there’s little you can do except see if someone has commented on a fix (check the original web site for comments), or contact the script writer. Posting scripts can be a tricky business because each and every character counts!
Hey, Anne-Marie Concepcion also showed how to do this (with even more details) in her InDesign Secrets video “Running a Script” at lynda.com!