Adobe 65048332 Manual page 24

Scripting guide
Table of Contents

Advertisement

C
3: Scripting Photoshop
HAPTER
AS
The following statement creates a
make new document
You can also use the
following example, the variable named
set docRef to make new document
To create an object other than a document, you must reference the
object. The following sample creates an art layer in the document contained in the variable named
.
docRef
make new art layer in docRef
N
: When you create object in AppleScript, you actually add the object to an element the same way you
OTE
add a VBScript or JavaScript object to a collection. However, in AppleScript, the element name is implied in
the
make
make new document
actually means:
make new document in the documents element
Do the following to find out more about creating objects in an AppleScript:
Look up the
the Photoshop AppleScript Dictionary. See
To find out which commands can be used with an object, look up the object in the Adobe Photoshop
CS5 AppleScript Scripting Reference. If an object has valid commands, there will be a "Valid Commands"
list at the end of the object description.
VBS
In VBScript, you can use the
objects other than collection objects. Also, in VBScript, you must reference the
creating when creating, or referring to, an object in your script.
For example, to create a document in a VBScript script, you cannot use the object name, as in the following
sample, which creates a
appRef.Document.Add()
You must use the collection name, which is a plural form of the object name, as follows:
appRef.Documents.Add()
N
: In this sample statement, the
OTE
"Targeting and Referencing the Application Object" on page 22
To add an
contain the art layer. The following sample references the
and the
Document
appRef.Documents(1).ArtLayers.Add()
N
: In Photoshop, VBScript collections index from 1 rather than 0. That is to say, the first document
OTE
created has index 1, rather than index 0.
command to create a variable to hold a reference to a new document. In the
set
or
statement. For example, the statement:
set
and
commands in the Adobe Photoshop CS5 AppleScript Scripting Reference or in
make
set
Add
Document
object, you must reference both the
ArtLayer
object using the document's index rather than the documents name.
object in an AppleScript.
Document
holds a reference to the new document:
docRef
"Viewing Photoshop's AppleScript dictionary" on page
method only with the collection name. The
object:
object is referenced via a variable named
Application
Creating New Objects in a Script 24
object that contains the
Document
Add
Application
for more information.
and
Application
Document
object using the variable
Application
21.
method is not valid with
object when
. See
appRef
objects that will
appRef

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

65048599Photoshop cs5

Table of Contents