Scripting InDesign CS3/4 with JavaScript

Peter Kahrel

Abstract

InDesign provides a powerful set of tools for producing beautiful documents. While you can certainly do all your work by hand through InDesign’s graphical interface, there are many times when it’s much easier to write a script. Once you’ve automated a task, you can run it over the whole document, ensuring consistency, or just when you need it, simplifying and speeding your layout process. All it takes is a bit of JavaScript knowledge and a willingness to explore InDesign’s programming features.

Introduction

Two things stand between the would-be scripter and an InDesign Javascript: InDesign’s object model and JavaScript. Though both are complex, once a few hurdles are overcome, anyone can start writing scripts fairly quickly. This PDF hopes to show that numerous tedious tasks in InDesign can be automated with very simple scripts of sometimes just one or two lines. These simple scripts can pave the way to more complicated scripts. What you need most of all is determination.

To give just one short example, imagine this task: you have a document with dozens of pages, and each page contains one or more text frames and one or more graphics. All these page items are on the same layer, and you decide that the document would be much easier to handle if the graphics were on a separate layer. The task, ...

Get Scripting InDesign CS3/4 with JavaScript 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.