Adobe 23101335 - Photoshop - PC Manual page 10

Scripting guide
Hide thumbs Also See for 23101335 - Photoshop - PC:
Table of Contents

Advertisement

2.2.2 Object inheritance
Object classes may also "inherit," or share, the properties of a parent, or superclass. When a
class inherits properties, we call that class a child, or subclass of the class from which it
inherits properties. So in our house example, windows and doors are subclasses of an openings
class, since they are both openings in a house. In Photoshop, art layers, for example, inherit
from the layer class.
Classes will often have properties that aren't shared with their superclass. In our house, both a
window and door inherit an opened property from the opening class, but a window has a
number of panes property which the Opening class doesn't. In Photoshop, art layers, for
example, have the property grouped which isn't inherited from the Layer class.
2.2.3 Object elements or collections
Object elements (AppleScript) or collections (Visual Basic, JavaScript) are objects contained
within other objects. For example, rooms are elements (or collections) of our house, contained
within the house object. In Photoshop, documents are elements of the application object, and
layers are elements of a document object. To access an element (or member of a collection),
you use an index. For example, to get the first document of the application you write:
AS: document 1
VB: appRef.Documents (1)
JS: documents[0];
IMPO R TAN T:
2.2.4 Object reference
The objects in your documents are arranged in a hierarchy like the house object — layers are
in layer sets, which are inside a document which is inside Photoshop. When you send a
command to a Photoshop object, you need to make sure you send the message to the right
object. To do this, you identify objects by their position in the hierarchy — by an object
reference. You might, for example, write the following statement.
AppleScript
layer 1 of layer set 1 of current document
Visual Basic
appRef.ActiveDocument.LayerSets(1).Layers(1)
JavaScript
activeDocument.layerSets[0].layers[0];
Photoshop 7.0 Scripting Guide
Indices in AppleScript and Visual Basic are 1 based. JavaScript indicies are 0
based.
Scripting basics
Object model concepts
2
10

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop 7.0

Table of Contents