Photoshop CS2
Adobe Photoshop CS2 Scripting Guide
Scripting Photoshop CS2 37
➤
To view the VBS object library:
1. Start Word, and then choose
Tools > Macro > Visual Basic Editor
.
2. Choose
Tools > References
., and then select the Adobe Photoshop CS2 Type Library check box and
click
OK
.
3. Choose
View > Object Browser
.
4. Choose Photoshop CS2
type library
from the list of open libraries shown in the top-left pull-down
menu.
5. Choose an object class to display more information abut the class.
Targeting and Referencing the Application Object
Because you run your AppleScript and VBScript scripts from outside the Photoshop CS2 application, the
first thing your script should do is indicate that the commands/methods be executed in Photoshop CS2.
Note:
In JavaScript, you do not need to target the
Application
object because you open the scripts from
the Photoshop CS2 application itself. (See
‘Creating and Running a JavaScript’ on
page 24
.)
AS
To target Photoshop CS2 in AppleScript, you must enclosing your script in the following statements:
tell application "Adobe Photoshop CS2"
…
end tell
Note:
Because you include all commands in the
tell
block, there is no need to reference the
Application
object throughout the script.
VBS
In VBScript, you can do any of the following to target the application:
Dim appRef
Set appRef = CreateObject("Photoshop.Application")
JS
In JavaScript, because you do not need to reference an
Application
object, all properties and methods of
the application are accessible without any qualification. You can reference the application as part of the
containment hierarchy or leave it out, whichever makes your scripts easier for you to read. The following
statements are equivalent:
var docRef = app.documents[1]
and
var docRef=documents[1]
Note:
JavaScript samples throughout this guide do not reference the
Application
object.
Creating New Objects in a Script
To create a new document in the Photoshop CS2 application, you select
File > New
. To create other types
of objects within a document, such as a layer, channel, or path, you use the Window menu or choose the
Содержание PHOTOSHOP CS 2.0 - SCRIPTING GUIDE
Страница 1: ...bbc Adobe Photoshop cs 2 Scripting Guide ...