Scripting Guide
Page 3
...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 ...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...
...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 ...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...
Scripting Guide
Page 4
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Contents 4 Working with Channel Objects ...45 Using the Document Info Object ...46 Using History State Objects...46 Using Notifier Objects ...47 Using the PathItem Object ......
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Contents 4 Working with Channel Objects ...45 Using the Document Info Object ...46 Using History State Objects...46 Using Notifier Objects ...47 Using the PathItem Object ......
Scripting Guide
Page 5
....documents.add Several conventions are provided in three languages: ● AppleScript ● VBScript ● JavaScriptTM Note: Separate Photoshop CS3 Scripting reference information is not otherwise accessible in VBScript and JavaScript. Please note the following shortcut notations: ● AS ...you to write scripts that target Photoshop CS3 functionality that property and the VBScript and JavaScript names appear in this manual. 1 Introduction About this manual This manual provides an introduction to scripting Adobe® Photoshop® CS3 on page 20. When referring ...
....documents.add Several conventions are provided in three languages: ● AppleScript ● VBScript ● JavaScriptTM Note: Separate Photoshop CS3 Scripting reference information is not otherwise accessible in VBScript and JavaScript. Please note the following shortcut notations: ● AS ...you to write scripts that target Photoshop CS3 functionality that property and the VBScript and JavaScript names appear in this manual. 1 Introduction About this manual This manual provides an introduction to scripting Adobe® Photoshop® CS3 on page 20. When referring ...
Scripting Guide
Page 6
AS layer 1 of layer set 1 of values specific to the JavaScript property. For larger blocks of code, scripting examples are sometimes used to organize lists of current document VBS appRef.ActiveDocument.LayerSets(1).Layers(1) JS app.activeDocument.layerSets[0].layers[0] Finally, tables are listed on separate lines. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Introduction 6 In this case, display dialogs refers to the AppleScript property, DisplayDialogs refers to the VBScript property and displayDialogs refers to each scripting language.
AS layer 1 of layer set 1 of values specific to the JavaScript property. For larger blocks of code, scripting examples are sometimes used to organize lists of current document VBS appRef.ActiveDocument.LayerSets(1).Layers(1) JS app.activeDocument.layerSets[0].layers[0] Finally, tables are listed on separate lines. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Introduction 6 In this case, display dialogs refers to the AppleScript property, DisplayDialogs refers to the VBScript property and displayDialogs refers to each scripting language.
Scripting Guide
Page 7
... Photoshop CS3 objects and commands, please use scripts instead of this installation: Adobe Photoshop CS3 AppleScript Scripting Reference, Adobe Photoshop CS3 Visual Basic Scripting Reference, and Adobe Photoshop CS3 JavaScript Scripting Reference. It provides a simple example of scripting for Photoshop, describes scripting support for Photoshop CS3...acquaint yourself with scripting or programming languages, you . ● For more information on the Photoshop CS3 object model, see 'Photoshop CS3 Object Model' on page 9. ● For information on selecting a scripting language, refer to ...
... Photoshop CS3 objects and commands, please use scripts instead of this installation: Adobe Photoshop CS3 AppleScript Scripting Reference, Adobe Photoshop CS3 Visual Basic Scripting Reference, and Adobe Photoshop CS3 JavaScript Scripting Reference. It provides a simple example of scripting for Photoshop, describes scripting support for Photoshop CS3...acquaint yourself with scripting or programming languages, you . ● For more information on the Photoshop CS3 object model, see 'Photoshop CS3 Object Model' on page 9. ● For information on selecting a scripting language, refer to ...
Scripting Guide
Page 8
... .scpt (none) .js .jsx .vbs .exe Platform Mac OS® Mac OS & Windows Windows Windows JavaScript Support For a JavaScript file to be accessed from the Adobe Photoshop CS3 Scripts menu (File > Scripts), which scripting language to be accessed directly from one computer to your JavaScripts. See 'Creating and Running an AppleScript' on page...
... .scpt (none) .js .jsx .vbs .exe Platform Mac OS® Mac OS & Windows Windows Windows JavaScript Support For a JavaScript file to be accessed from the Adobe Photoshop CS3 Scripts menu (File > Scripts), which scripting language to be accessed directly from one computer to your JavaScripts. See 'Creating and Running an AppleScript' on page...
Scripting Guide
Page 9
...displayed in the Scripts menu. When you select a script file, it in the Scripts folder (Photoshop CS3 /Presets /Scripts). The DOM allows you to Scripting. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 9 To install a JavaScript in the Scripts menu, place it is executed the ..., are displayed in it must include code such as defined for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CS3/Adobe Photoshop If your script is an application programming interface (API), which allows you to the Scripts menu. For more ...
...displayed in the Scripts menu. When you select a script file, it in the Scripts folder (Photoshop CS3 /Presets /Scripts). The DOM allows you to Scripting. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 9 To install a JavaScript in the Scripts menu, place it is executed the ..., are displayed in it must include code such as defined for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CS3/Adobe Photoshop If your script is an application programming interface (API), which allows you to the Scripts menu. For more ...
Scripting Guide
Page 10
..., a Layersets collection, and a Channels collection. Through using commands or methods in the Photoshop CS3 DOM. In Photoshop CS3, the Application object sits at the top of the Photoshop CS3 DOM, and how each node in the hierarchy represents a class in the DOM, you...object model diagram below , each aspect of the functionality available through the Photoshop CS3 user interface is a containment hierarchy, which index from 1 rather than 0. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 10 a new document, add a layer to an existing ...
..., a Layersets collection, and a Channels collection. Through using commands or methods in the Photoshop CS3 DOM. In Photoshop CS3, the Application object sits at the top of the Photoshop CS3 DOM, and how each node in the hierarchy represents a class in the DOM, you...object model diagram below , each aspect of the functionality available through the Photoshop CS3 user interface is a containment hierarchy, which index from 1 rather than 0. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 10 a new document, add a layer to an existing ...
Scripting Guide
Page 11
...about an image's color. You can create a spot color channel, a masked area channel, and a selected area channel. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 11 The Application class is used to specify an area of pixels in the active document (or in a ...more information on text items, see 'Working with Layer Objects' on page 20. Image color determines the number of the Photoshop CS3 object model hierarchy. Selection Class The Selection class is the root of channels available. See 'Targeting and Referencing the Application Object...
...about an image's color. You can create a spot color channel, a masked area channel, and a selected area channel. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 11 The Application class is used to specify an area of pixels in the active document (or in a ...more information on text items, see 'Working with Layer Objects' on page 20. Image color determines the number of the Photoshop CS3 object model hierarchy. Selection Class The Selection class is the root of channels available. See 'Targeting and Referencing the Application Object...
Scripting Guide
Page 12
... Class The Measurement Scale object provides scripting support for the new Measurement Scale feature that allows you to the Photoshop CS3 user interface. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 12 History State Class The History State class is a palette object that keeps track of a ... added to a script. Notifier Class The Notifier object ties an event to the palette. The Containment Hierarchy and the Photoshop CS3 User Interface The following table provides describes how each point in the Path Item class, and provides the actual geometry of...
... Class The Measurement Scale object provides scripting support for the new Measurement Scale feature that allows you to the Photoshop CS3 user interface. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 12 History State Class The History State class is a palette object that keeps track of a ... added to a script. Notifier Class The Notifier object ties an event to the palette. The Containment Hierarchy and the Photoshop CS3 User Interface The following table provides describes how each point in the Path Item class, and provides the actual geometry of...
Scripting Guide
Page 13
... file, such filename, creation date and time, author name, the name of an image without using a script: Application The Photoshop CS3 application. Document The working object, in Mac OS. Choose Window > Channels. Choose Layer > New > Layer Set. Channel ... history state from the History palette. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 13 Object Name Description To create this object without affecting or Window > Layers. Start the Photoshop CS3 application. In a script, you saved it. In Photoshop CS3, choose File > New or File >...
... file, such filename, creation date and time, author name, the name of an image without using a script: Application The Photoshop CS3 application. Document The working object, in Mac OS. Choose Window > Channels. Choose Layer > New > Layer Set. Channel ... history state from the History palette. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 13 Object Name Description To create this object without affecting or Window > Layers. Start the Photoshop CS3 application. In a script, you saved it. In Photoshop CS3, choose File > New or File >...
Scripting Guide
Page 14
...Throughout this document, actual values of value that define the allowed values for the Art Layer object's kind property. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 14 Object Name Description Color Sampler Represents a color sampler in the document. Choose the Count Tool and...object without using Image > Measurement Scale > Custom. For example, look up the art ArtLayer object in either the Adobe Photoshop CS3 JavaScript Scripting Reference or in the containment hierarchy above. Constants are passed to view the values you can use the same...
...Throughout this document, actual values of value that define the allowed values for the Art Layer object's kind property. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 14 Object Name Description Color Sampler Represents a color sampler in the document. Choose the Count Tool and...object without using Image > Measurement Scale > Custom. For example, look up the art ArtLayer object in either the Adobe Photoshop CS3 JavaScript Scripting Reference or in the containment hierarchy above. Constants are passed to view the values you can use the same...
Scripting Guide
Page 15
...Art Layer object as the value of the text item to "Hello World". Note: The default location for Photoshop CS3. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 15 Creating a Sample Hello World Script This section demonstrates a very simple script in each of ...artLayerRef. 4. In fact, because this procedure. Open the Photoshop CS3 application. 2. The document will also include comments throughout the scripts. Note: We will be 4 inches wide and 2 inches high....
...Art Layer object as the value of the text item to "Hello World". Note: The default location for Photoshop CS3. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 15 Creating a Sample Hello World Script This section demonstrates a very simple script in each of ...artLayerRef. 4. In fact, because this procedure. Open the Photoshop CS3 application. 2. The document will also include comments throughout the scripts. Note: We will be 4 inches wide and 2 inches high....
Scripting Guide
Page 16
... text and sets the text to "Hello, World" Note: If you encounter errors, refer to Introduction to Scripting, which has a section on AppleScript debugging. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 16 Note: The lines preceded by this script Dim originalRulerUnits originalRulerUnits = appRef.Preferences.RulerUnits appRef.Preferences.RulerUnits = 2 ' Create a new 2x4 inch document...
... text and sets the text to "Hello, World" Note: If you encounter errors, refer to Introduction to Scripting, which has a section on AppleScript debugging. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 16 Note: The lines preceded by this script Dim originalRulerUnits originalRulerUnits = appRef.Preferences.RulerUnits appRef.Preferences.RulerUnits = 2 ' Create a new 2x4 inch document...
Scripting Guide
Page 17
... language to run your file system. Save file as a text file with a .vbs file name extension. 3. Double-click the file in Photoshop CS3. The script opens Photoshop CS3. Type the following script. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 17 appRef.Preferences.RulerUnits = originalRulerUnits 2. Note: Entering comments is optional. // Hello Word Script // Remember current unit settings and...
... language to run your file system. Save file as a text file with a .vbs file name extension. 3. Double-click the file in Photoshop CS3. The script opens Photoshop CS3. Type the following script. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 17 appRef.Preferences.RulerUnits = originalRulerUnits 2. Note: Entering comments is optional. // Hello Word Script // Remember current unit settings and...
Scripting Guide
Page 18
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 18 Note: Photoshop CS3 also supports JavaScript files that use a .js extension. 3. Do either of the following: ● If Photoshop CS3 is already open, choose File > Scripts > Browse, and then navigate to the Presets > Scripts folder and choose your script. ● Start or restart Photoshop CS3, and then choose File > Scripts, and then select your script from the Scripts menu.
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 18 Note: Photoshop CS3 also supports JavaScript files that use a .js extension. 3. Do either of the following: ● If Photoshop CS3 is already open, choose File > Scripts > Browse, and then navigate to the Presets > Scripts folder and choose your script. ● Start or restart Photoshop CS3, and then choose File > Scripts, and then select your script from the Scripts menu.
Scripting Guide
Page 19
... this installation: ● Adobe Photoshop CS3 AppleScript Scripting Reference ● Adobe Photoshop CS3 Visual Basic Scripting Reference ● Adobe Photoshop CS3 JavaScript Scripting Reference In addition, you quickly understand how to view the dictionary. Script Editor opens Photoshop CS3 and then displays the Photoshop CS3 dictionary, which lists objects as well as the commands, properties and elements associated with Photoshop CS3. 3 Scripting Photoshop CS3 This chapter demonstrates...
... this installation: ● Adobe Photoshop CS3 AppleScript Scripting Reference ● Adobe Photoshop CS3 Visual Basic Scripting Reference ● Adobe Photoshop CS3 JavaScript Scripting Reference In addition, you quickly understand how to view the dictionary. Script Editor opens Photoshop CS3 and then displays the Photoshop CS3 dictionary, which lists objects as well as the commands, properties and elements associated with Photoshop CS3. 3 Scripting Photoshop CS3 This chapter demonstrates...
Scripting Guide
Page 20
... Browse drop-down menu. 5. Choose an object class to display more information about the class. The selected library appears in the Photoshop CS3 library are listed. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 20 Viewing Photoshop CS3's Type Library (VBS) You can use the object browser in the Visual Basic development environment to display the objects and commands...
... Browse drop-down menu. 5. Choose an object class to display more information about the class. The selected library appears in the Photoshop CS3 library are listed. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 20 Viewing Photoshop CS3's Type Library (VBS) You can use the object browser in the Visual Basic development environment to display the objects and commands...
Scripting Guide
Page 21
...new document: AS The following statement creates a Document object in the 'Photoshop CS3 Object Model' on page 9, the Document object contains all other than the class name. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 21 ... VBS In VBScript, do the following example, the variable ...objects except the Application, Notifier, and Preferences objects. For example, you want to reference an Application object, all commands in the Photoshop CS3 application, you use the set command to create a variable to hold a reference to read. make ● VBS: Add ...
...new document: AS The following statement creates a Document object in the 'Photoshop CS3 Object Model' on page 9, the Document object contains all other than the class name. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 21 ... VBS In VBScript, do the following example, the variable ...objects except the Application, Notifier, and Preferences objects. For example, you want to reference an Application object, all commands in the Photoshop CS3 application, you use the set command to create a variable to hold a reference to read. make ● VBS: Add ...
Scripting Guide
Page 22
... to say, the first document created has index 1, rather than index 0. make or set statement. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 22 set docRef to make new document To create an object other than collection objects. See 'Viewing Photoshop CS3's AppleScript Dictionary' on either the ArtLayers or LayerSets collections. If an object has valid commands...
... to say, the first document created has index 1, rather than index 0. make or set statement. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 22 set docRef to make new document To create an object other than collection objects. See 'Viewing Photoshop CS3's AppleScript Dictionary' on either the ArtLayers or LayerSets collections. If an object has valid commands...