Adobe 27510753 Scripting Guide - Page 78

engine, include, includepath, the include paths are ignored. Otherwise

Page 78 highlights

70 Using ExtendScript Tools and Features Adobe InDesign CS2 Scripting Guide #engine name Identifies the ExtendScript engine that runs this script. This allows other engines to refer to the scripts in this engine by importing the exported functions and variables. See the "Importing and exporting between scripts" section. #include file Use JavaScript identifier syntax for the name. Enclosing quotes are optional. For example: #engine library #engine "$lib" Includes a JavaScript source file from another location. Inserts the contents of the named file into this file at the location of this statement. The file argument is an Adobe portable file specification. See the "Specifying Paths" section. As a convention, use the file extension .jsxinc for JavaScript include files. For example: #include "../include/lib.jsxinc" To set one or more paths for the #include statement to scan, use the #includepath preprocessor directive. If the file to be included cannot be found, ExtendScript throws a run-time error. #includepath path Included source code is not shown in the debugger, so you cannot set breakpoints in it. One or more paths that the #include statement should use to locate the files to be included. The semicolon (;) separates path names. If a #include file name starts with a slash (/), it is an absolute path name, and the include paths are ignored. Otherwise, ExtendScript attempts to find the file by prefixing the file with each path set by the #includepath statement. For example: #includepath "include;../include" #include "file.jsxinc" Multiple #includepath statements are allowed; the list of paths changes each time an #includepath statement is executed. As a fallback, ExtendScript also uses the contents of the environment variable JSINCLUDE as a list of include paths. Some engines can have a predefined set of include paths. If so, the path provided by #includepath is tried before the predefined paths. If, for example, the engine has a predefined path set to predef;predef/include, the preceding example causes the following lookup sequence: l file.jsxinc: literal lookup l include/file.jsxinc: first #includepath path l ../include/file.jsxinc: second #includepath path l predef/file.jsxinc: first predefined engine path l predef/include/file.jsxinc: second predefined engine path

  • 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

70
Using ExtendScript Tools and Features
Adobe InDesign CS2 Scripting Guide
#engine
name
Identifies the ExtendScript engine that runs this script. This allows other engines to
refer to the scripts in this engine by importing the exported functions and vari-
ables. See the “Importing and exporting between scripts” section.
Use JavaScript identifier syntax for the name. Enclosing quotes are optional. For
example:
#engine library
#engine "$lib"
#include
file
Includes a JavaScript source file from another location. Inserts the contents of the
named file into this file at the location of this statement. The
file
argument is an
Adobe portable file specification. See the “Specifying Paths” section.
As a convention, use the file extension
.jsxinc
for JavaScript include files. For
example:
#include "../include/lib.jsxinc"
To set one or more paths for the
#include
statement to scan, use the
#include-
path
preprocessor directive.
If the file to be included cannot be found, ExtendScript throws a run-time error.
Included source code is not shown in the debugger, so you cannot set breakpoints
in it.
#includepath
path
One or more paths that the
#include
statement should use to locate the files to
be included. The semicolon (
;
) separates path names.
If a
#include
file name starts with a slash (
/
), it is an absolute path name, and
the include paths are ignored. Otherwise, ExtendScript attempts to find the file by
prefixing the file with each path set by the
#includepath
statement.
For example:
#includepath "include;../include"
#include "file.jsxinc"
Multiple
#includepath
statements are allowed; the list of paths changes each
time an
#includepath
statement is executed.
As a fallback, ExtendScript also uses the contents of the environment variable
JSINCLUDE
as a list of include paths.
Some engines can have a predefined set of include paths. If so, the path provided
by
#includepath
is tried before the predefined paths. If, for example, the engine
has a predefined path set to
predef;predef/include
, the preceding example
causes the following lookup sequence:
file.jsxinc
: literal lookup
include/file.jsxinc
: first
#includepath
path
../include/file.jsxinc:
second
#includepath
path
predef/file.jsxinc
: first predefined engine path
predef/include/file.jsxinc
: second predefined engine path
l
l
l
l
l