Photoshop CS2
Adobe Photoshop CS2 Scripting Guide
Scripting basics 11
AS
In AppleScript, you use the object type name followed by a space and then the index. The following
statement refers to the current document. Notice that the element name is implied rather than used
explicitly.
document 1
Note:
If the element name were used, this statement would be
document 1 of documents
.
AppleScript abbreviates the syntax by inferring the element name from the object type name.
In AppleScript, the number that refers to an object in an element changes when the script manipulates
other objects. Unless you update the older art layer’s status to “active layer”, references made to
art
layer 1
of current document refer to the new layer.
Note:
See
‘Setting the Active Object’ on page 39
for more information about selecting the active
layer.
Tip:
For beginning scripters, it’s a good idea to name all objects in your AppleScripts and then refer to the
objects by name.
VBS
In VBScript, you use the collection name followed by the index enclosed in parentheses. There is no space
between the collection name and the parentheses.
Documents(1)
JS
In JavaScript, the collection name is followed by the index in square brackets with no space between the
object name and the brackets.
documents[0]
Object References
Because scripts use a containment hierarchy, you can think of an object reference as being similar to the
path to a file.
You can use an object’s name or index to refer to the object. (See
‘Indexes or Indices’ on page 10
.)
The following code samples demonstrate the syntax for referring to an
artLayer
object named
Profile
,
which was the first layer added to the
layerSet
object named
Silhouettes
, which in turn was the first
layer added to the current document:
AS
Object index reference:
layer 1 of layer set 1 of current document
Object name reference:
layer "Profile" of layer set "Silhouettes" of current document
Note:
When you refer to an object by name, you must enclose the name in double quotes ("").
You can also combine the two types of syntax:
layer 1 of layer set "Silhouettes" of current document
Содержание PHOTOSHOP CS 2.0 - SCRIPTING GUIDE
Страница 1: ...bbc Adobe Photoshop cs 2 Scripting Guide ...