Using Variables - Adobe PHOTOSHOP CS 2.0 - SCRIPTING GUIDE Manual

Table of Contents

Advertisement

Adobe Photoshop CS2 Scripting Guide
Some commands require additional data. In AppleScript, the
can specify properties for the object by enclosing the properties in brackets and preceding the brackets
with the phrase with properties. The following statement creates a new document that is four inches wide
and two inches high.
make new document with properties {width:4 as inches, height:2 as inches}
Note:
See
performs the task on the correct object.
Methods and Arguments
You insert methods at the end of a VBScript or JavaScript statement. You must place a period before the
method name to separate it from the rest of the statement.
The following VBScript statement prints the current document:
appRef.Documents(1).PrintOut
A method in JavaScript must be followed by parentheses, as in the following statement:
app.documents[0].print()
Some methods require additional data, called arguments, within the parentheses. Other methods have
optional arguments. The following statements use the
named myDocument that is 4000 pixels wide and 5000 pixels tall and has a resolution of 72 pixels per inch:
Note:
Even though the
(myDocument), you use the object collection name when you add the object. See
an Object in an Element or Collection' on page 10
collections. See
versus object names in a singular form.
VBS
appRef.Documents.Add(4000, 5000, 72, "myDocument", 5)
Note:
The enumerated value
the constant
contains detailed information about enumerated values and constants.
JS
app.documents.add(4000, 5000, 72, "myDocument", DocumentMode.BITMAP)

Using Variables

A variable is a container for data you use in your script. For example, in the following AppleScript
statements the variables
new document.
Without variables:
make new document with properties {width:4 as inches, height:2 as inches}
With variables:
set docWidth to 4 inches
set docHeight to 2 inches
make new document with properties {docWidth, docHeight}
'Setting the Active Object' on page 39
Document
'Object References' on page 11
at the end of the script statement indicates the value
5
PsNewDocumentMode
docWidth
Photoshop CS2
for information on making sure your script
Add/add()
object in the following script statements is given a name
. The Adobe Photoshop CS2 Visual Basic Scripting Reference
and
replace the width and height specifications for the
docHeight
command adds a new object. You
make new
method to add a bitmap document
for more information on object
for information on object collection names
Scripting basics
13
'Referring to
for
psNewBitmap

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop cs2

Table of Contents