Adobe InDesign is an incredibly powerful document layout tool. One of the greatest features that make it even more powerful though it the ability to write scripts to automate document creation. In this post, the aim is just to give an overview of:
- What scripting allows you to do
- Scripting choices
- How to get started with scripting
- Examples of how scripting can be used
What does scripting allow you to do?
Scripting allows you to automate functions that InDesign can perform using code. Think of it this way, basically anything that you can interact with in InDesign by using your mouse and keyboard, you can control with code. So simple things like opening documents, creating new documents, exporting documents as PDFs, closing documents etc can be done with code. This allows you to do really repetitive work and also some dynamic work where some logic is involved in a short amount of time.
Scripting Choices
InDesign actually gives you a choice of scripting languages that you can use. The choices are Applescript or Javascript. Going forward, I’ll only be talking about Javascript since that’s been my main focus. If you’re familiar with Applescript already and only plan on ever having your scripts be used on Apple computers, then have at it. Otherwise, Javascript is the way to go. In my opinion, Javascript is a really good language to learn. The syntax is very similar to Java and the Javascript that you might use if you were designing websites. My main reason for using Javascript, however, is the fact that is is platform independent. By that, I meant that you can use it on Apple computers or regular PCs. You might have to tweak the code a little if you’re using operating system specific stuff like accessing hard drives though. In the end, Javascript means that you can use it on any computer and more people can use your script.
How to get started with scripting
If you’ve never used scripting before, finding the functionality in InDesign is the first step. In fact, InDesign actually comes with a decent amount of sample scripts out of the box. To access this go to the menu bar at the top and click on Window->Utilities->Scripts. This opens up the scripts panel which looks a bit like a file directory. To access the sample scripts, double click on Application -> Samples. There you’ll see folders for Javascript and Applescript. Clicking on either one brings up a whole list of individual scripts. Scripts can be run by simply double clicking on them. If you want to view or edit the code, you can open the files with any text editor. But for development, you should get Extendscript. If you have InDesign, it’s a free IDE offered by Adobe to develop and test scripts. It also has an excellent reference called “Object Viewer Model.” I use that quite often when trying to implement new functionality.
Real examples of how scripting can be used
- Creating variable data documents such as mailing labels by importing data from Microsoft Excel files
- Customizing a template document such as a Welcome Guide and exporting the PDF so users don’t actually have to manually edit an InDesign document
- Creating business cards from an InDesign template using data from Excel
- Exporting information from a document to a comma delimited file
What repetitive tasks are you doing with InDesign that could be automated? If you’re already using scripting, what type of projects have you completed?
Leave a Reply