Chapter 37. Using Scripts

IN THIS CHAPTER

  • Installing and accessing scripts

  • Exploring JavaScript

  • Exploring AppleScript

  • Exploring VBA

  • Writing scripts

  • Learning more about scripting

Scripting automates many features in InDesign — it's essentially a way to program InDesign to do specific actions. Because InDesign uses standard script languages, you can also run scripts that work with multiple programs in concert, including InDesign. (All the applications must support the same scripting language, of course.) For example, you might use scripts to automate database publishing, such as to run a database search, export data to a text file, import that file into InDesign, and then apply the appropriate formatting.

InDesign supports three scripting languages:

  • JavaScript on both Mac and Windows

  • AppleScript on the Mac only

  • Visual Basic for Applications (VBA), on Windows only

Because only JavaScript is supported by both platforms, I recommend you use it wherever possible so that your scripts can work in cross-platform environments. InDesign doesn't force you to choose just one scripting language, so you could keep using old AppleScript or VBA scripts created for previous versions of InDesign, as well as new scripts written in JavaScript.

As you become comfortable with scriptwriting, you're also likely to discover that virtually everything you do with InDesign is a repetitive task. The more you can free yourself of this kind of work by using scripts, the more time you have to be creative. The possibilities ...

Get InDesign® CS4 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.