|
Insight
Increase Your InDesign Productivity with Scripting
By John Cruise
Dateline: February 22, 2006
Version: Adobe InDesign CS
More Insight articles
|
| Mention the word “scripting” to a designer and the response is likely to be, “I’m an artist, not a programmer.” Fortunately, you don’t need to write scripts to use scripts, which you can think of as macros on steroids for automating repetitive and tedious tasks.
|
|
Getting Started
The easiest way to get started with scripts is to
try the scripts included with InDesign. You’ll find
them in the Scripting folder within the Adobe
Technical Info folder on the InDesign CS CD (or
on the Resources and Extras CD if you own the
Creative Suite). Mac users can use the AppleScript
or JavaScript files; Windows users can use Visual
Basic Script or JavaScript files. Make the scripts
available to InDesign by placing the scripts in the
Scripts folder, which is in the Presets folder of
InDesign. (Note: Make sure
to shut down and restart InDesign anytime you
install a script.)
|
|
Running Scripts
After you install the scripts, you’ll find them
displayed in the Scripts palette (Window > Scripting
> Scripts). To run a script, double-click it in
the palette. To see what a simple script can do,
click within a paragraph and then double-click on
the TabUtilities script in the Scripts palette. The
dialog box displays four options for setting a tab
stop and a fi eld (Tab Leader) for specifying a fill
character. Although the features in the TabUtilities
script are available elsewhere in InDesign, it’s
possible for a script to add unique features that
aren’t otherwise available. Pretty powerful stuff.
|
|
Downloading Free Scripts
Another way to begin dabbling with scripts is to
download some from the Adobe Web site. The
Adobe Studio Exchange has InDesign scripts, with
more than 100 free scripts available. For example,
there’s a free FontBook script (in JavaScript) by
Jonas Ranneby for both Mac and Windows that allows users to print a font book that generates
seven formatted lines in different type sizes for
all active or individual fonts in InDesign. Cool, useful,
and you can’t beat the price!
|
|
Writing Scripts
If you’re the adventurous type and have a few minutes
to spare, you should try writing a script from
scratch. Be forewarned: It’s easy to get hooked on
scripting. Try a really easy one by first opening a
text editor, and enter the text below. Make sure
you add a return character after each line.
In AppleScript:
try
tell application “InDesign CS”
set mydocument to make document
end tell
end try
In Visual Basic:
Set myInDesign = Create Object (“InDesign.Application.CS”)
Set my Document = myInDesign.Document.Add
Save the file as NewDoc, then add the file extension
.as if you’re using a Mac, or .scpt if you’re
on Windows. Save to the Scripts folder of InDesign
in the Applications folder (InDesign folder > Presets
> Scripts). Launch InDesign, open the Scripts
palette (Window > Scripting > Scripts) and double-click
on the NewDoc script.
|
|
Scripting References
If you’d like to get more familiar with scripting
terms and script writing, check out the built-in
dictionaries in your operating system. If using a
Mac, open Apple Scripts > Script Editor > Open
Dictionary, select Adobe InDesign CS from the
applications (or choose Browse and select the In-Design application itself), and you’ll see an InDesign
dictionary of scripting terms! If using Windows,
open Visual Basics > Project > References > Adobe
InDesign Type Library > View > Object Browser >
InDesign, and Visual Basic gives you a definition to
any selected object or command.
|
|
Don't miss the next tip on Graphics.com. Get the free Graphics.com newsletter in your mailbox each week. Click here to subscribe.
|
John Cruise is a Denver-based trainer, writer and co-author of
books about QuarkXPress and InDesign.
|
|