3
Contents
1
Introduction
.................................................................................................................................
5
About this manual
..........................................................................................................................................................................
5
Conventions in this guide
...........................................................................................................................................................
5
2
Photoshop CS3 Scripting Basics
.................................................................................................
7
Scripting Overview
........................................................................................................................................................................
7
Why use scripts instead of actions?
...................................................................................................................................
7
Scripting Support in Photoshop CS3
......................................................................................................................................
8
JavaScript Support
...................................................................................................................................................................
8
Startup Scripts
...........................................................................................................................................................................
9
Executing JavaScripts from AS or VBS
..............................................................................................................................
9
Photoshop CS3 Object Model
....................................................................................................................................................
9
Containment Hierarchy
.......................................................................................................................................................
10
The Containment Hierarchy and the Photoshop CS3 User Interface
..................................................................
12
Additional Objects
.................................................................................................................................................................
14
Constants
..................................................................................................................................................................................
14
Creating a Sample Hello World Script
...................................................................................................................................
15
Creating and Running an AppleScript
............................................................................................................................
15
Creating and Running a VBScript
.....................................................................................................................................
16
Creating and Running a JavaScript
.................................................................................................................................
17
3
Scripting Photoshop CS3
..........................................................................................................
19
Viewing Photoshop CS3 Objects, Commands, and Methods
......................................................................................
19
Viewing Photoshop CS3’s AppleScript Dictionary
.....................................................................................................
19
Viewing Photoshop CS3’s Type Library (VBS)
..............................................................................................................
20
Targeting and Referencing the Application Object
.........................................................................................................
20
Creating New Objects in a Script
............................................................................................................................................
21
Setting the Active Object
..........................................................................................................................................................
23
Setting the Active Document
............................................................................................................................................
24
Setting the Active Layer
.......................................................................................................................................................
25
Setting the Active Channels
...............................................................................................................................................
25
Opening a Document
.................................................................................................................................................................
26
Opening a File with Default File Format
........................................................................................................................
26
Specifying File Formats to Open
......................................................................................................................................
27
Saving a Document
.....................................................................................................................................................................
29
Setting Application Preferences
............................................................................................................................................
30
Allowing or Preventing Dialogs
..............................................................................................................................................
31
Working with the Photoshop CS3 Object Model
..............................................................................................................
31
Using the Application Object
............................................................................................................................................
31
Using the Document Object
..............................................................................................................................................
32
Working with Layer Objects
...............................................................................................................................................
34
Creating an ArtLayer Object
...............................................................................................................................................
34
Creating a Layer Set Object
................................................................................................................................................
35
Working with Layer Set Objects
........................................................................................................................................
37
Using the Text Item Object
.................................................................................................................................................
39
Working with Selection Objects
.......................................................................................................................................
41