Object References - Adobe PHOTOSHOP CS 2.0 - SCRIPTING GUIDE Manual

Table of Contents

Advertisement

Adobe Photoshop CS2 Scripting Guide
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:
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
layer 1
Note:
See
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
The following code samples demonstrate the syntax for referring to an
which was the first layer added to the
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
If the element name were used, this statement would be
AppleScript abbreviates the syntax by inferring the element name from the object type name.
of current document refer to the new layer.
'Setting the Active Object' on page 39
Photoshop CS2
for more information about selecting the active
object named Silhouettes, which in turn was the first
layerSet
Scripting basics
document 1 of documents
'Indexes or Indices' on page 10
object named Profile,
artLayer
11
.
art
.)

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop cs2

Table of Contents