Chapter 2 Scripting Basics; Documents As Objects; Object Model Concepts - Adobe 23101335 - Photoshop - PC Manual

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

Advertisement

2

2.1 Documents as objects

If you use Photoshop, then you create documents, layers, channels and design elements and
can think of a Photoshop document as a series of layers and channels — or objects.
Automating Photoshop with scripting uses the same object-oriented way of thinking.
The heart of a scriptable application is the object model. In Photoshop, the object model is
comprised of documents, layers and channels. Each object has its own special properties, and
every object in a Photoshop document has its own identity.
This chapter covers the basic concepts of scripting within this object-oriented environment.

2.2 Object model concepts

The terminology of object oriented programming can be hard to understand, at first. "Objects"
belong to "classes" and have "properties" you manipulate using "commands" (AppleScript) or
"methods" (Visual Basic and JavaScript). What do these words mean in this context?
Here's a way to think about objects and their properties as an object model. Imagine that you
live in a house that responds to your commands. The house is an object, and its properties
might include the number of rooms, the color of the exterior paint or the date of its
construction.
Your house can also contain other objects within. Each room, for example, is an object in the
house, while each window, door, or appliance is an object inside of the room. And each object
can respond to various commands according to its capabilities.
Now apply this object model concept to Photoshop. The Photoshop application is the house,
its documents are the rooms, and the objects in your documents are the windows and doors.
You can tell Photoshop documents to add and remove objects or manipulate individual objects.
2.2.1 Object classes
Objects with the same properties and behaviors are grouped into "classes." In the house
example, windows and doors belong to their own classes because they have unique properties.
In Photoshop, every type of object— document, art layer, etc.—belongs to its own class, each
with its own set of properties and behaviors.
Photoshop 7.0 Scripting Guide
Scripting basics
9

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop 7.0

Table of Contents