is now part of!

Book Excerpt: JavaScript for InDesign

InDesign Magazine Issue 132: After EffectsThis article appeared in Issue 132 of InDesign Magazine.

Don’t wait for Adobe to create the features you want in InDesign—make them yourself by learning JavaScript.

Anyone who works regularly in InDesign has compiled a wish list of features they’d like to see added to the program. But perhaps the greatest feature of them all already exists—the ability to control InDesign with scripts. That means you—yes, you!—can create the features you want. But first you need to learn how to tell InDesign what you want in a language that it understands, like Java­Script. And the best way to learn it for the purpose of writing InDesign scripts is to read Peter Kahrel’s book, JavaScript for InDesign. In the following pages, we present an excerpt to get you started, along with an exclusive set of simple one-liner scripts that Peter came up with to give you a quick taste of success.

. . . .

This article from InDesign Magazine is for InDesignSecrets premium subscribers only. To continue reading, please log in above, or sign up for a premium membership today! Thanks for supporting InDesignSecrets!

  • Is there a script that will check endnotes and match them to Chicago style?

  • Peter Kahrel says:

    There might be, but it won’t be a one-liner, which is what the article is about.

  • only curious if it is possible. can i have a script run automatically after a user double clicks a page in the pages panel? i simply want to have the “fit spread in window” menu item evoked after the mouse double clicks a page.

    • Peter Kahrel says:

      A script can’t do that, that would require a plug-in. You could press Ctrl+Alt+0 (or its Mac equivalent). If the function wasn’t set as a shortcut, you can define a key combination to set the view.

  • karien says:

    Hi Peter,
    I’m a fan of your scripts! But the thing I miss the most in Indesign is a sort of Time Tracker. I paid for the Open Hour-version, bur unfortunately they stopped their support. Is it possible to make a script that registers AUTOMATICALLY when you work in Indesign without having to switch it on and off. I keep forgetting that, so the Paymo Time Tracker isn’t ideal for me…

  • Peter Kahrel says:

    Hi Karien. It looks as if it’s possible for an InDesign script to detect when the app becomes active and when it’s quit. You’d better head over to the scripting forum ( or to Adobe’s Scripting forum ( The latter is probably better for what you’re after. There are several good script writers there who can do your script (for a fee).

  • Cristian Ronban says:

    I would love to buy the book, but I’m afraid of your shop partner asking for private data and forcing you to accept giving them away in order to buy it…

  • >