Specifications
Writing a user script
To write a user script, simply provide the JavaScript statements that should be executed in the
main body of the script file. If your script encounters an error, it should set the $error variable
to the appropriate error message; otherwise it should leave the $error variable alone. See below
for a typical coding pattern.
The following special global variables are defined before your script executes, and thus their
value can be used in your script; in some cases (noted in the variable's description) your script
should also set or update the contents of the variable.
DescriptionVariable
The first argument passed to the script (or the empty string if there
is none)
$arg1
The second argument passed to the script (or the empty string if
there is none)
$arg2
The third argument passed to the script (or the empty string if there
is none)
$arg3
The fourth argument passed to the script (or the empty string if there
is none)
$arg4
The fifth argument passed to the script (or the empty string if there
is none)
$arg5
The absolute path of the input file, including name and extension;
this is used mostly in a script attached to an "open" action
$infile
The currently active document, that is, the document that was
opened by the "open" action; $doc is null for a script attached to an
"open" action (or when the "open" action failed)
$doc
Important note: use $doc instead of "this" to refer to the currently
active document
The absolute path of the folder in which to place the output; this is
used mostly in a script attached to a "save" action
$outfolder
The filename (without extension) of the input (and output) file$filename
The filename extension of the input file, or if it does not have one,
the filename extension corresponding to the Mac file types of the
input file
$extension
The incoming value of this variable is irrelevant$outfiles
If your script is attached to a "save" action, it should set the contents
of this array variable to the absolute paths of the output files
generated by the script
The incoming value of this variable is irrelevant$jobfolder
If your script is attached to a "save" action, it should set the contents
of this variable as follows:
203
Enfocus Switch 10