Photoshop CS2
Adobe Photoshop CS2 Scripting Guide
Scripting basics 15
Using the Variable in a Script
After declaring and assigning values to your variables, you use the variables in your script to represent the
value; you use only the variable name without the
set
or
copy
command. The following statement uses
the
display dialog
command to create a dialog box with the text
Hello World
.
display dialog thisString
Assigning an Object Reference as a Value
You can also use variables to store references to objects. (See
‘Object References’ on page 11
for an
explanation of object references.) The following statement creates a variable named
thisLayer
and as
its value, creates a new
Art Layer
object. When you use
thisLayer
in a script statement, you are
referring to the new layer.
set thisLayer to make new art layer in current document
You can also assign a reference to an existing object as the value:
set thisLayer to art layer 1 of current document
AppleScript Value Types
You can use the following types of values for variables in your AppleScripts.
Note:
For now, don’t worry about the value types you don’t understand.
VBS
To create a variable in VBScript, you use the
Dim
keyword at the beginning of the statement. The following
statements create the variables
thisNumber
and
thisString
.
Dim thisNumber
Dim thisString
You can declare multiple variables in a single
Dim
statement by separating the variables with a comma (,),
as follows:
Dim thisNumber, thisString
Value Type
What It Is
Sample Value
boolean
Logical true or false.
true
integer
Whole numbers (no decimal
points). Integers can be positive
or negative.
14
real
A number that may contain a
decimal point.
13.9972
string
A series of text characters.
Note:
Strings appear inside
(straight) quotation
marks.
"I am a string"
list
An ordered list of values. The
values of a list may be any type.
{10.0, 20.0, 30.0, 40.0}
object
A specific reference to an object.
current document
record
An unordered list of properties,
Each property is identified by its
label.
{name: "you", index: 1}
Содержание PHOTOSHOP CS 2.0 - SCRIPTING GUIDE
Страница 1: ...bbc Adobe Photoshop cs 2 Scripting Guide ...