Photoshop Object Model; Containment Hierarchy - Adobe 65048332 Manual

Scripting guide
Table of Contents

Advertisement

C
2: Photoshop Scripting Basics
HAPTER

Photoshop Object Model

A document object model (DOM) is an application programming interface (API), which allows you to
programmatically access various components of a document (as defined for that application) through a
scripting language. For additional information about Adobe object models and the scripting languages
that support them, see Introduction to Scripting.
The Photoshop DOM consists of a hierarchical representation of the Photoshop application, the
documents used in it, and the components of the documents. The DOM allows you to programmatically
access and manipulate the document and its components. For example, through the DOM, you can create
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 user interface is available through the DOM.
A good understanding of the Photoshop 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 object model is a containment hierarchy, which means that objects in the model are
identified partially by the objects that contain them. In Photoshop, the
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 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 DOM.
The Photoshop 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:
Color Samplers
Notifiers
more information on elements and collections.
N
: In Photoshop, VBScript collections index from 1 rather than 0. This stands in contrast to other
OTE
VBScript arrays, which index from 0.
,
,
Count Items
Documents
,
,
Path Items
Path Points Sub Path Items
,
,
,
Layers
Layer Comps
, and
Text Fonts
Photoshop Object Model 11
object sits at the top
Application
Art Layers
,
Layer Sets
History States
. See Introduction to Scripting for
,
,
Channels
,

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

65048599Photoshop cs5

Table of Contents