Setting The Active Object - Adobe 65048332 Manual

Scripting guide
Table of Contents

Advertisement

C
3: Scripting Photoshop
HAPTER
If you look up in the
Visual Basic Object Browser, you will see that there is no
method is available for the
method; the
N
: The
OTE
method. The
Add()
with the
the
Layers
JS
In JavaScript, you can use the
with objects other than collection objects.
Similar to VBScript, the JavaScript statement to create a document is:
documents.add()
and not:
document.add()
N
: You can include an
OTE
to the previous sample:
app.documents.add()
To add an
method for the
add()
documents[0].artLayers.add()
As with VBScript, the
Document
does.
N
: The
OTE
object in the Adobe Photoshop CS5 JavaScript Scripting Reference.
Layers

Setting the Active Object

To work on a an object in the Photoshop application, you must make the object the front-most, or active
object. For example, to work in a layer, you must first bring the layer to the front.
In scripting, the same rule applies. If your script creates two or more documents, the commands and
methods in your script are executed on the active document. Therefore, to ensure that your commands are
acting on the correct document, it is good programming practice to designate the active document
before executing any commands or methods in the script.
To set an active object, do the following:
In AppleScript, you use the
In VBScript, you use the
ActiveLayer
In JavaScript, you use the
activeLayer
object in the Adobe Photoshop CS5 Visual Basic Scripting Reference or in the
Document
Documents
object does.
ArtLayers
object is an exception because, although it is a collection object, it does not include an
Layers
collection includes both
Layers
method on either the
Add
object in the Adobe Photoshop CS5 Visual Basic Scripting Reference.
add()
Application
object, you must reference the
ArtLayer
ArtLayers
method is associated with the JavaScript
add()
object. Similarly, the
ArtLayer
collection object does not include an
Layers
ActiveObject
).
activeObject
).
object. Similarly, the
ArtLayer
or
ArtLayers
LayerSets
method only with the collection name. The
object reference if you wish. The following statement is equivalent
Document
collection, using the
object does not have an
property of the parent object.
current
property of the parent object (such as
property of the parent object (such as
method for the object. However, the
Add()
object does not have an
ArtLayer
and
LayerSet
collections. For more information, look up
object that contains the layer, and use the
property of
artLayers
Documents
method; the
add()
method. For more information, look up the
add()
Setting the Active Object 25
Add()
Add()
objects, which are created
method is not valid
add()
.
Document
object but not with the
object
ArtLayers
or
ActiveDocument
activeDocument
or

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

65048599Photoshop cs5

Table of Contents