
Photoshop CS3
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Basics 10
a new document, add a layer to an existing document, or change the background color of a layer. Most of
the functionality available through the Photoshop CS3 user interface is available through the DOM.
A good understanding of the Photoshop CS3 DOM, and how each aspect of the DOM relates to the
Photoshop application and its documents will make script writing easier.
Containment Hierarchy
The Photoshop CS3 object model is a containment hierarchy, which means that objects in the model are
identified partially by the objects that contain them. In Photoshop CS3, the
Application object sits at the
top of the hierarchy. Applications contain a Documents collection. The Documents collection contains
Document objects. A Document object contains an ArtLayers collection, a HistoryStates collection, a
Layers collection, a Layersets collection, and a Channels collection. Through using commands or methods
in the DOM, you can tell Photoshop CS3 documents to add and remove objects, or set or change
individual object properties like color, size and shape. In the diagram below, each node in the hierarchy
represents a class in the Photoshop CS3 DOM.
The Photoshop CS3 object model uses elements (AppleScript) or collections (VBScript, JavaScript) as a
convenient way to group classes. We have not shown object elements or collections in the object model
diagram below. Not all classes are associated with a collection. However, some key classes are grouped by
elements or collection. The following elements/collections exist in Photoshop CS3:
Art Layers,
Channels, Color Samplers, Count Items, Documents, Layers, Layer Comps, Layer Sets, History
States
, Notifiers, Path Items, Path Points Sub Path Items, and Text Fonts. See Introduction to
Scripting for more information on elements and collections.
Caution: In Photoshop, VBScript collections index from 1 rather than 0. This stands in contrast to other
VBScript arrays, which index from 0.
.
Application and Document Classes
Application
Document
Art Layer
Channel
Selection
History
State
Photoshop Containment Hierarchy
Text Item
Layer Set
Layer Set
Path Item
Path Point
(Object)
Info
Document
Art Layer
Notifier
Comp
Layer
Preferences
Sub Path
Item
(showing key classes only)
Item
Count
Sampler
Color
Scale
Measurement