Adobe 27510753 Scripting Guide - Page 10

JavaScript, Macintosh, Windows, How to use the scripts in this document - download

Page 10 highlights

2 Introduction Adobe InDesign CS2 Scripting Guide Although the scripting systems differ, the ways that they work with InDesign are similar. Each example script in this manual is shown in all languages. Translating a script from one language to another is a fairly easy task. JavaScript InDesign supports JavaScript for cross-platform scripting in both Mac OS and Windows. InDesign's JavaScript support is based on an Adobe implementation of JavaScript known as ExtendScript. The ExtendScript interpreter conforms to the current ECMA 262 standard for JavaScript. All language features of JavaScript 1.5 are supported, including try/catch/finally, equality operators, and the new instanceof and in operators. Adobe GoLive® and other Adobe products also use the ExtendScript JavaScript interpreter. Macintosh To use InDesign scripting on the Macintosh, you can use either JavaScript or AppleScript. To write AppleScripts, you must have AppleScript version 1.6 or higher and an AppleScript script editor. AppleScript comes with all Apple systems, or can be downloaded free from the Apple website. The Apple Script Editor is included with the Mac OS; third-party script editors, such as Script Debugger (from Late Night Software, http://www.latenightsw.com), are also available. Windows To use InDesign scripting in Windows, you can use either JavaScript or some version of Microsoft Visual Basic, such as VBScript. To create InDesign scripts using VBScript, you need only a text editor (such as Notepad). Other versions of Visual Basic include Visual Basic 5 Control Creation Edition (CCE), Visual Basic 6, Visual Basic .NET, or an application that contains Visual Basic for Applications (VBA). Microsoft Office, Visio, AutoCAD, and other programs include VBA. Although InDesign supports VBA, it does not include VBA. To use VBScript or VisualBasic for InDesign scripting in Windows, you must install InDesign from a user with Administrator privileges. After you've completed the installation, any user can run InDesign scripts, and any user with Power User or Adminstrator privileges can add scripts to the InDesign Scripts palette. How to use the scripts in this document To use any script from this document: 1. Copy the script from this Adobe® PDF® document and paste it into your script editor, such as Notepad in Windows or TextEdit in Mac OS. Important: Read the next section, "Copying Examples with Long Lines". 2. Save the script as a plain text file in the Scripts folder inside the Presets folder in your InDesign folder (create the Scripts folder if it does not exist), using the appropriate file extension: l .as for AppleScript l .jsx for JavaScript l .vbs for VBScript Note: You can also store the script file at another location and place an alias (Mac OS) or shortcut (Windows) to the file in the Scripts folder.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184

2
Introduction
Adobe
InDesign CS2 Scripting Guide
Although the scripting systems differ, the ways that they work with InDesign are similar. Each example script
in this manual is shown in all languages. Translating a script from one language to another is a fairly easy task.
JavaScript
InDesign supports JavaScript for cross-platform scripting in both Mac OS and Windows. InDesign’s JavaScript
support is based on an Adobe implementation of JavaScript known as ExtendScript. The ExtendScript
interpreter conforms to the current ECMA 262 standard for JavaScript. All language features of JavaScript 1.5
are supported, including try/catch/finally, equality operators, and the new
instanceof
and
in
operators.
Adobe GoLive® and other Adobe products also use the ExtendScript JavaScript interpreter.
Macintosh
To use InDesign scripting on the Macintosh, you can use either JavaScript or AppleScript. To write
AppleScripts, you must have AppleScript version 1.6 or higher and an AppleScript script editor. AppleScript
comes with all Apple systems, or can be downloaded free from the Apple website. The Apple Script Editor
is included with the Mac OS; third-party script editors, such as Script Debugger (from Late Night Software,
http://www.latenightsw.com), are also available.
Windows
To use InDesign scripting in Windows, you can use either JavaScript or some version of Microsoft Visual Basic,
such as VBScript. To create InDesign scripts using VBScript, you need only a text editor (such as Notepad).
Other versions of Visual Basic include Visual Basic 5 Control Creation Edition (CCE), Visual Basic 6, Visual Basic
.NET, or an application that contains Visual Basic for Applications (VBA). Microsoft Office, Visio, AutoCAD, and
other programs include VBA. Although InDesign supports VBA, it does not include VBA.
To use VBScript or VisualBasic for InDesign scripting in Windows, you must install InDesign from a user with
Administrator privileges. After you’ve completed the installation, any user can run InDesign scripts, and any
user with Power User or Adminstrator privileges can add scripts to the InDesign Scripts palette.
How to use the scripts in this document
To use any script from this document:
1.
Copy the script from this Adobe® PDF® document and paste it into your script editor, such as Notepad in
Windows or TextEdit in Mac OS.
Important:
Read the next section, “Copying
Examples with Long Lines”.
2.
Save the script as a plain text file in the Scripts folder inside the Presets folder in your InDesign folder (cre-
ate the Scripts folder if it does not exist), using the appropriate file extension:
.as
for AppleScript
.jsx
for JavaScript
.vbs
for VBScript
Note:
You can also store the script file at another location and place an alias (Mac OS) or shortcut
(Windows) to the file in the Scripts folder.
l
l
l