ii
Contents
Adobe InDesign CS2 Scripting Guide
Control structures
.......................................................................................................
15
Conditional statements
........................................................................................................
15
Loops
...........
�
16
Subroutines and handlers
........................................................................................
17
3
Getting Started with InDesign Scripting
...............
19
Measurements and positioning
.............................................................................
19
Coordinates
...............................................................................................................................
19
Measurement units
................................................................................................................
20
The InDesign document object model
...............................................................
21
Looking at the InDesign object model
...........................................................................
21
Your first InDesign script
...........................................................................................
22
Adding features to “Hello World”
..........................................................................
25
Adding a user interface to "Hello World"
............................................................
29
Dialog box overview
.............................................................................................................
29
Adding the user interface
........................................................................................
30
Creating a more complex user interface
........................................................................
33
Handling errors
............................................................................................................
39
Using palettes to manage scripts
..........................................................................
40
Using the Scripts palette
......................................................................................................
40
Using the Script Label palette
............................................................................................
41
Testing and troubleshooting
...................................................................................
42
AppleScript debugging
........................................................................................................
42
VBScript debugging
..............................................................................................................
42
JavaScript debugging
...........................................................................................................
42
4
Using ExtendScript Tools and Features
.................
43
The ExtendScript Toolkit
...........................................................................................
44
Configuring the Toolkit window
.......................................................................................
44
Selecting a debugging target
...........................................................................................
45
Selecting scripts
.....................................................................................................................
46
Tracking data
............................................................................................................................
47
The JavaScript console
........................................................................................................
48
The call stack
...........................................................................................................................
48
The Script Editor
......................................................................................................................
49
Debugging in the Toolkit
.....................................................................................................
50
Profiling
......
�
54
Dollar ($) Object
..........................................................................................................
55
Dollar ($) object properties
.................................................................................................
55
Dollar ($) object functions
...................................................................................................
56
ExtendScript Reflection Interface
..........................................................................
58
Reflection Object
...................................................................................................................
58
ReflectionInfo Object
...........................................................................................................
59
Localizing ExtendScript Strings
..............................................................................
60
Variable values in localized strings
..................................................................................
61
Enabling automatic localization
.......................................................................................
61
Locale names
...........................................................................................................................
62
Testing localization
................................................................................................................
62
Global localize function
.......................................................................................................
63