IT tutorials

Adobe InDesign CS5 : Using Scripts & Script tips

2/4/2012 3:57:03 PM
- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire

1. Using Scripts

Accessing scripts is easy; they show up in the Scripts panel (choose Window => Utilities => Scripts or press Option++F11 or Ctrl+Alt+F11) if you've placed scripts in the Scripts folder inside the folder that contains the InDesign application, as shown in Figure 1. Scripts don't have to be in the Scripts folder — they can be anywhere on your computer — but to use them outside this folder means you have to double-click them from your desktop rather than have access from within InDesign.

Figure 1. The Scripts panel in InDesign and its flyout menu

2. Script tips

When writing scripts, you can associate a script to a specific InDesign menu action so that when a user chooses that menu item, a script runs automatically (technically, by assigning a script to a MenuAction command's Prenotify or Postnotify property when writing the script's code). In InDesign, be sure that Enable Attached Scripts is also enabled in the Scripts panel's flyout menu.

When running scripts, keep the following tips in mind:

  • You can undo all of a script's action by using the InDesign Undo command (choose Edit => Undo or press +Z or Ctrl+Z) by ensuring that Undo Affects Entire Script is enabled in the Scripts panel's flyout menu. Otherwise, the undo command reverses just the last action within the script, requiring you to undo several times to roll back the complete script action.

  • By enabling the Enable Redraw flyout menu option in the Scripts panel, you can force InDesign to redraw the display while a script is running. This ensures that any changes to the document are immediately visible.


You can now access InDesign's Tools panel and its tools via scripts in InDesign CS5.

2.1. Script locations

Whether you create your own scripts or get them from vendors or other users, you need to save them so that InDesign knows they exist. You have a choice of two locations:

  • The Scripts folder inside the InDesign application folder. You can usually find it as Applications:Adobe InDesign CS5:Scripts in Mac OS X, and Program Files\Adobe\InDesign CS5\Scripts in Windows. This makes the script available to all users of your computer. If you want the script to start when InDesign launches, place it in the Startup Scripts subfolder.

  • The Script Panel folder. This makes the script available only to that specific user (note that it will appear in a folder called User in your Scripts panel). The path varies based on your operating system:

    • On the Mac, the path is Users:username:Library:Preferences:Adobe InDesign:Version 7.0:en_US:Scripts:Scripts Panel.

    • In Windows XP, the path is Documents and Settings\username\Application Data\Adobe\InDesign\Version 7.0\en_US\Scripts\Scripts Panel.

    • In Windows Vista, the path is Users\username\AppData\Roaming\Adobe\ InDesign\Version 7.0\en_US\Scripts\Scripts Panel.

    • In Windows 7, the path is Users\username\AppData\Roaming\Adobe\ InDesign\Version 7.0\en_US\Scripts\Scripts Panel.

The script shows up in the Scripts panel. If it doesn't show up immediately, quit and reopen InDesign.

To use scripts developed for InDesign CS4, create a new folder called Version 6.0 Scripts inside the Scripts or Script Panel folder and move your old scripts there. Likewise, scripts developed for InDesign CS3 should be placed in a folder called Version 5.0 Scripts. These scripts then work in InDesign CS5.

2.2. Scripting principles

No matter what scripting language you use, there are several basic principles to observe. These fall into four basic categories:

  • Grammar: All languages — including programming languages such as Pascal and C++, as well as scripting languages — include grammatical components that are used in standardized sequences. In English, we combine nouns, verbs, adjectives, adverbs, and so on to create sentences. Everybody knows the meaning of "The weather is especially nice today," because it uses common words in a sequence that makes sense. The sentence "Nice is the especially today weather" has the right components but it's arranged in the wrong sequence, so the meaning is lost.

  • Statements and syntax rules: In JavaScript, AppleScript, and VBA, verbs, nouns, adjectives, and prepositions are combined to create statements; statements are combined to form scripts. Verbs are also called commands and methods; nouns are called objects; and adjectives are called properties. Syntax rules specify how statements and scripts must be constructed so that a computer can understand them.

  • Object hierarchy: All three scripting languages use a structural element called an object hierarchy. It's a fancy term for a simple concept. An object hierarchy works like a set of boxes within boxes. A large box contains a smaller box, which contains a smaller box, which contains a smaller box, and so on, until you reach the smallest box, which contains nothing and is the final level in the hierarchy of boxes.

  • InDesign hierarchy: InDesign contains its own hierarchy, which lends itself nicely to scripting. A document contains pages, pages contain frames, and frames contain text and pictures. You can create scripts that perform actions at any of these levels. In other words, with scripts you can create documents, add pages, add items to pages, and modify the contents of frames, right down to a particular character in a text frame. You can think of this hierarchy in InDesign as a chain of command. You can't talk directly to an item that's at the bottom of the chain. Rather, you must first address the top level, and then the next, and so on, until you've reached the item at the bottom of the chain. This is analogous to the way you use InDesign: You create new documents, add pages, place text and graphics on the pages, and, finally, modify the contents of the frames containing those items.

If you're thinking about dabbling with any of the scripting languages supported by InDesign, the following words of both caution and encouragement are in order. First the encouragement: You don't necessarily need programming experience, scripting experience, or a pocket protector to begin creating scripts. A bit of curiosity and a touch of patience will suffice. Now the caution: Scripting is essentially a euphemism for programming (that is, figuring out the right commands and then typing them for the application to execute). Writing scripts isn't a matter of choosing commands from menus, and clicking and dragging them, or entering values into fields; nor is it like writing a limerick. If you're starting from scratch, know in advance that you have to learn some new skills.

Be forewarned: There's something almost narcotic about creating scripts, and it's not uncommon for novice scriptwriters to get hooked. Don't be surprised if what starts out to be a 15-minute look-see turns into a multihour, late-night programming episode.


Because scripting languages differ, you can't always duplicate the functionality of a specific script in one language into a script written in a different language.


Adobe has a nearly 2,000-page scripting guide available as a PDF file. It comes with your InDesign or Creative Suite software, residing on the installation DVD. You can find additional resources at
- Adobe Flash Catalyst CS5 : Changing stroke and fill (part 2) - Change stroke color and weight, Add and modify gradient fills
- Adobe Flash Catalyst CS5 : Changing stroke and fill (part 1) - Change the fill color
- Adobe Illustrator CS5 : Working with Layers - Showing and Hiding Layers and Objects, Merging Layers and Groups
- Adobe Illustrator CS5 : Working with Layers - Duplicating Layers and Objects, Locking Layers and Objects
- Dreamweaver CS5 : Editing Content in the Browser (part 2) - Registering an InContext Editing site & Making edits online
- Dreamweaver CS5 : Editing Content in the Browser (part 1) - Setting up InContext Editing templates
- Dreamweaver CS5 : Using Dreamweaver Templates - Updating Templates & Removing Template Markup
- Adobe Photoshop CS5 : Fixing Problems Caused by Your Camera’s Lens
- Adobe Photoshop CS5 : Removing Tourists the Easy Way
- Adobe After Effects CS5 : Adding transparency & Rendering the composition
Youtube channel
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
programming4us programming4us
Popular tags
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS