Photoshop CS2
Adobe Photoshop CS2 Scripting Guide
Scripting basics 7
●
Adobe Photoshop CS2 Visual Basic Scripting Reference
●
Adobe Photoshop CS2 JavaScript Scripting Reference
Tip:
Throughout this guide, explanations of how to create a script for a task are followed by instructions
for looking up in the appropriate scripting reference the specific elements used in the script. Using
these instructions will help you quickly understand how to script Photoshop CS2.
Writing Script Statements
A scripting language, like human languages, uses sentences or
statements
, for communication. To write a
script statement:
●
Name an object.
●
Name the property you want to change or create.
●
Indicate the task you want to perform on the object’s property. In AppleScript, you use a
command
. In
VBScript and JavaScript, you use a
method
.
For example, to create a new document called
myDocument
, you would write a script statement that says
Add a document called myDocument
In this example, the object is
document
, its “name” property is
myDocument
, and the command or method
is
add
.
Syntax
Because you use scripting languages to communicate with the your computer, you must follow strict rules
that the computer can understand. These rules are called the language’s
syntax
.
The syntaxes for AppleScript, VBScript, and JavaScript are different. In this guide, you will learn basic
scripting concepts that these languages share. You will also learn some of the syntax that is specific to
each language.
Object Model Concepts
In a script statement, you refer to an object based on where the object is located in an
object model
. An
object model is simply an arrangement of objects. The arrangement is called a
containment hierarchy
.
Here’s a way to think about object models:
1. You live in a house, which we will think of as your
house
object.
2. The house has rooms, which we will call its
room
objects.
3. Each room has
window
and
door
objects.
Windows can be open or shut. (In other words, a
window
object has an
open
property that indicates
whether or not the window is open.)
If you want to write a script that opens a window in your house, you would use the property or
command/method that accomplishes the task. But first, you need to identify the window. This is where the
object model comes in: you identify the window by stating where it is in the careful arrangement of
objects contained in your house.
First of all, the window is contained by the house. But there are lots of windows, so you need to provide
more detail, such as the room in the house. Again, there is probably more than one window in each room,
so you’d also need to provide the wall that the window is in. Using the house object model, you would
identify the window you want to open as "the window on the north wall in the living room in my house".
Содержание PHOTOSHOP CS 2.0 - SCRIPTING GUIDE
Страница 1: ...bbc Adobe Photoshop cs 2 Scripting Guide ...