Adobe photoshop cs 2.0 User Guide
Photoshop CS2
Adobe Photoshop CS2 Scripting Guide
Scripting basics 20
myFiles[1] = “clouds.gif”
myFiles[2] = “clouds.jpg”
myFiles[3] = “clouds.pdf”
myFiles[2] = “clouds.jpg”
myFiles[3] = “clouds.pdf”
Notice that each value is numbered. To use a value in a statement, you must include the number. The
following statement opens the file clouds.gif:
following statement opens the file clouds.gif:
open(myFiles[1])
The following sample includes the same statements in VBScript:
Dim myFiles (4)
myFiles(0) = “clouds.bmp”
myFiles(1) = “clouds.gif”
myFiles(2) = “clouds.jpg”
myFiles(3) = “clouds.pdf”
myFiles(0) = “clouds.bmp”
myFiles(1) = “clouds.gif”
myFiles(2) = “clouds.jpg”
myFiles(3) = “clouds.pdf”
appRef.Open myFiles(1)
Documenting Scripts
You can document the details of your script by including comments throughout the script. Because of the
way they are formatted, comments are ignored by the scripting system as the script executes.
way they are formatted, comments are ignored by the scripting system as the script executes.
Comments help clarify (to humans, including yourself ) what your script does. It is generally considered
good programming practice to document each bit of logic in your script.
good programming practice to document each bit of logic in your script.
You use comments to:
●
Help you remember the purpose of a section of your script.
●
Help you remember to include all the components you planned for your script. Unless you are an
experienced programmer, you can review your script by reading through the comments more easily
than you can by reading the code.
experienced programmer, you can review your script by reading through the comments more easily
than you can by reading the code.
●
Help others understand your script. It’s possible that other people in your organization will need to use,
update, or debug your script.
update, or debug your script.
Comment Syntax
You can create the following types of comments:
●
Single-line: An entire line is a comment and therefore ignored when your script runs.
●
End-of-line: The line begins with executable code, then becomes a comment which is ignored when
the script runs.
the script runs.
●
Multi-line: An entire block of text, which runs more than a single line in your script, is a comment.
The following sections demonstrate how to format comments in your scripts.
AS
To enter a single-line or end-of-line comment in an AppleScript, type two hyphens (--) before the
comment.
comment.
-- this is a single-line comment
set thisNumber to 10 --this is an end-of-line comment
set thisNumber to 10 --this is an end-of-line comment
To include a multi-line comment, start your comment with a left-parenthesis followed by an asterisk ( (* )
and end with an asterisk followed by a right-parenthesis ( *) ), as in the following example.
and end with an asterisk followed by a right-parenthesis ( *) ), as in the following example.
(* this is a
multi-line comment *)