Setting The Active Object - Adobe PHOTOSHOP CS 2.0 - SCRIPTING GUIDE Manual

Table of Contents

Advertisement

Adobe Photoshop CS2 Scripting Guide
You must use the collection name, which is a plural form of the object name, as follows:
appRef.Documents.Add()
Note:
In this sample statement, the
'Targeting and Referencing the Application Object' on page 37
To add an
contain the art layer. The following sample references the
and the
Document
appRef.Documents(0).ArtLayers.Add()
If you look up in the
see that there is no
for the
Documents
object does.
Note:
The
Add()
information, look up the
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()
Note:
You can include an
to the previous sample:
To add an
documents(0).artLayers.add()
The
add()
(refer to the Adobe Photoshop CS2 JavaScript Scripting Reference).
Similarly, the
Note:
The
Layers

Setting the Active Object

To work on a an object in the Photoshop CS2 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
object, you must reference both the
ArtLayer
object using the documents index rather than the
object in the Adobe Photoshop CS2 Visual Basic Scripting Reference, you will
Document
method in the object's Methods table. However, the
Add()
object. Similarly, the
object is an exception because, although it is a collection object, it does not include an
Layers
method. The
Layers
Layers
add()
Application
app.documents.add()
object, you must reference the
ArtLayer
method is associated with the JavaScript
object does not have an
ArtLayer
collection object does not include an
Layers
object in the Adobe Photoshop CS2 JavaScript Scripting Reference.
current
Photoshop CS2
object is referenced via a variable named
Application
Application
object does not have an
ArtLayer
collection includes both
object in the scripting reference.
method only with the collection name. The
object reference if you wish. The following statement is equivalent
Document
Documents
method; the
add()
add()
property of the parent object.
Scripting Photoshop CS2
and
Document
object using the variable
Application
object's name.
Document
Add()
Add()
and
ArtLayer
LayerSet
add()
object that will contain the layer.
object but not with the
object does.
ArtLayers
method. For more information, look up the
39
. See
appRef
for more information.
objects that will
appRef
method is available
method; the
ArtLayers
objects. For more
method is not valid
object
Document

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop cs2

Table of Contents