Adobe 23102480 Scripting Guide - Page 3

Contents, Introduction, Photoshop CS3 Scripting Basics, Scripting Photoshop CS3 - part

Page 3 highlights

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 3

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85

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