Photoshop CS2
Adobe Photoshop CS2 Scripting Guide
Scripting basics 17
JS
The
var
keyword declares (that is, creates) variables in JavaScript. The following example uses separate
statements to declare and assign a value to the variable
thisNumber
; the variable
thisString
is
assigned and declared in a single statement.
var thisNumber
thisNumber = 10
var thisString = "Hello, World"
To assign a reference to an object in JavaScript, you use the same syntax as other JavaScript assignment
statements:
var docRef =
app.activeD
ocument
JavaScript Value Types
You can use the following types of values for variables.
Note:
For now, don’t worry about the value types you don’t understand.
Naming Variables
It’s a good idea to use descriptive names for your variables—such as
firstPage
or
corporateLogo
,
rather than names only you would understand and that you might not recognize when you look at your
Object
Properties and methods
belonging to an object or
array
activeDocument
Documents(1).ArtLayers(2)
String
A series of text characters.
Strings appear inside
(straight) quotation marks
"Hello"
"123 Main St."
" "
Value Type
What It Is
Example (Continued)
Value Type
What It Is
Examples
String
A series of text characters
that appear inside
(straight) quotation marks
"Hello"
"123 Main St."
" "
Number
Any number not inside
double quotes
3.7
15000
Boolean
Logical true or false
true
Null
Something that points to
nothing
Object
Properties and methods
belonging to an object or
array
activeDocument
Documents(1).artLayers(2)
Function
Value returned by a
function
See
‘Using Subroutines,
Handlers and Functions’
on page 29
.
Undefined
Devoid of any value
undefined
Содержание PHOTOSHOP CS 2.0 - SCRIPTING GUIDE
Страница 1: ...bbc Adobe Photoshop cs 2 Scripting Guide ...