Adobe 23102480 Scripting Guide - Page 22

Viewing Photoshop CS3's AppleScript Dictionary' on,

Page 22 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 22 set docRef to make new document To create an object other than a document, you must reference the Document object that contains the object. The following sample creates an art layer in the document contained in the variable named docRef. make new art layer in docRef Note: When you create object in AppleScript, you actually add the object to an element the same way you add a VBScript or JavaScript object to a collection. However, in AppleScript, the element name is implied in the make or set statement. For example, the statement: 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 make and set commands in the Adobe Photoshop CS3 AppleScript Scripting Reference or in the Photoshop CS3 AppleScript Dictionary. See 'Viewing Photoshop CS3's AppleScript Dictionary' on page 19. ● To find out which commands can be used with an object, look up the object in the Adobe Photoshop CS3 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 Add method only with the collection name. The Add method is not valid with objects other than collection objects. Also, in VBScript, you must reference the Application object when 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 Document object: appRef.Document.Add() 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 Application object is referenced via a variable named appRef. See 'Targeting and Referencing the Application Object' on page 20 for more information. To add an ArtLayer object, you must reference both the Application and Document objects that will contain the art layer. The following sample references the Application object using the variable appRef and the Document object using the document's index rather than the documents name. appRef.Documents(1).ArtLayers.Add() Caution: In Photoshop, VBScript collections index from 1 rather than 0. That is to say, the first document created has index 1, rather than index 0. If you look up in the Document object in the Adobe Photoshop CS3 Visual Basic Scripting Reference or in the Visual Basic Object Browser, you will see that there is no Add() method for the object. However, the Add() method is available for the Documents object. Similarly, the ArtLayer object does not have an Add() method; the ArtLayers object does. Note: The Layers object is an exception because, although it is a collection object, it does not include an Add() method. The Layers collection includes both ArtLayer and LayerSet objects, which are created with the Add method on either the ArtLayers or LayerSets collections. For more information, look up the Layers object in theAdobe Photoshop CS3 Visual Basic Scripting Reference.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85

Photoshop CS3
Adobe Photoshop CS3
Scripting Guide
Scripting Photoshop CS3
22
set docRef to make new document
To create an object other than a document, you must reference the
Document
object that contains the
object. The following sample creates an art layer in the document contained in the variable named
docRef
.
make new art layer in docRef
Note:
When you create object in AppleScript, you actually add the object to an element the same way you
add a VBScript or JavaScript object to a collection. However, in AppleScript, the element name is
implied in the
make
or
set
statement. For example, the statement:
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
make
and
set
commands in the
Adobe Photoshop CS3 AppleScript Scripting Reference
or in
the Photoshop CS3 AppleScript Dictionary. See
‘Viewing Photoshop CS3’s AppleScript Dictionary’ on
page 19
.
To find out which commands can be used with an object, look up the object in the
Adobe Photoshop
CS3 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
Add
method
only
with the collection name. The
Add
method is not valid with
objects other than collection objects. Also, in VBScript, you must reference the
Application
object when
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
Document
object:
appRef.Document.Add()
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
Application
object is referenced via a variable named
appRef
. See
‘Targeting and Referencing the Application Object’ on page 20
for more information.
To add an
ArtLayer
object, you must reference both the
Application
and
Document
objects that will
contain the art layer. The following sample references the
Application
object using the variable
appRef
and the
Document
object using the document’s index rather than the documents name.
appRef.Documents(1).ArtLayers.Add()
Caution:
In Photoshop, VBScript collections index from 1 rather than 0. That is to say, the first document
created has index 1, rather than index 0.
If you look up in the
Document
object in the
Adobe Photoshop CS3 Visual Basic Scripting Reference
or in the
Visual Basic Object Browser, you will see that there is no
Add()
method for the object. However, the
Add()
method is available for the
Documents
object. Similarly, the
ArtLayer
object does not have an
Add()
method; the
ArtLayers
object does.
Note:
The
Layers
object is an exception because, although it is a collection object, it does not include an
Add()
method. The
Layers
collection includes both
ArtLayer
and
LayerSet
objects, which are
created with the
Add
method on either the
ArtLayers
or
LayerSets
collections. For more
information, look up the
Layers
object in the
Adobe Photoshop CS3 Visual Basic Scripting Reference
.