Scripting Guide
Page 3
... The containment hierarchy and the Photoshop user interface 14 Additional objects 16 Constants 16 Creating a sample Hello World script 17 Creating and running an AppleScript 18 Creating and running a VBScript 19 Creating and running a JavaScript 19 3 Scripting Photoshop 21 Viewing Photoshop Objects, Commands, and Methods 21 Viewing Photoshop's AppleScript dictionary 21 Viewing Photoshop's type library (VBS 22 Targeting and Referencing the Application Object 22 Creating New Objects in a Script 23 Setting the Active Object 25 Setting the active document 26 3
... The containment hierarchy and the Photoshop user interface 14 Additional objects 16 Constants 16 Creating a sample Hello World script 17 Creating and running an AppleScript 18 Creating and running a VBScript 19 Creating and running a JavaScript 19 3 Scripting Photoshop 21 Viewing Photoshop Objects, Commands, and Methods 21 Viewing Photoshop's AppleScript dictionary 21 Viewing Photoshop's type library (VBS 22 Targeting and Referencing the Application Object 22 Creating New Objects in a Script 23 Setting the Active Object 25 Setting the active document 26 3
Scripting Guide
Page 4
...channels 28 Opening a Document 28 Opening a file with default file format 28 Specifying file formats to open 29 Saving a Document 31 Setting Application Preferences 32 Allowing or Preventing Dialogs 33 Working with the Photoshop Object Model 33 Using the Application object 34 Using the Document object 34 Manipulating a document object 35 Working with layer objects 36 Creating an ArtLayer object 37 Creating a Layer Set object 38 Referencing ArtLayer objects 38 Working with Layer Set objects 39 Linking layer objects 40 Applying styles to layers 40 Using the Text Item object 41...
...channels 28 Opening a Document 28 Opening a file with default file format 28 Specifying file formats to open 29 Saving a Document 31 Setting Application Preferences 32 Allowing or Preventing Dialogs 33 Working with the Photoshop Object Model 33 Using the Application object 34 Using the Document object 34 Manipulating a document object 35 Working with layer objects 36 Creating an ArtLayer object 37 Creating a Layer Set object 38 Referencing ArtLayer objects 38 Working with Layer Set objects 39 Linking layer objects 40 Applying styles to layers 40 Using the Text Item object 41...
Scripting Guide
Page 6
... 21 and "Viewing Photoshop's type library (VBS)" on Mac OS® and Windows®. NOTE: Please review the README file shipped with Photoshop for each of these languages through the Scripting Reference Manuals provided with this installation, or through the object browsers available for late-breaking news, sample scripts, and information about using the Extend Script Object Model Viewer, see the JavaScript Tools Guide. Conventions in this Guide Code and specific language samples appear...
... 21 and "Viewing Photoshop's type library (VBS)" on Mac OS® and Windows®. NOTE: Please review the README file shipped with Photoshop for each of these languages through the Scripting Reference Manuals provided with this installation, or through the object browsers available for late-breaking news, sample scripts, and information about using the Extend Script Object Model Viewer, see the JavaScript Tools Guide. Conventions in this Guide Code and specific language samples appear...
Scripting Guide
Page 8
... time consuming to scripting, you are new to do the following list to locate information that the script automatically makes "decisions" based on 8 For example, you to add depending on the current situation. For example, you could write a script to generate a number of localized versions of a particular image or to gather information about the Photoshop objects and commands through the object browsers for each of the three scripting languages. 2 Photoshop Scripting...
... time consuming to scripting, you are new to do the following list to locate information that the script automatically makes "decisions" based on 8 For example, you to add depending on the current situation. For example, you could write a script to generate a number of localized versions of a particular image or to gather information about the Photoshop objects and commands through the object browsers for each of the three scripting languages. 2 Photoshop Scripting...
Scripting Guide
Page 11
... you to programmatically access various components of a document (as a convenient way to group classes. A Document object contains an ArtLayers collection, a HistoryStates collection, a Layers collection, a Layersets collection, and a Channels collection. Most of the functionality available through the Photoshop user interface is available through the DOM, you can tell Photoshop documents to add and remove objects, or set or change the background color of the hierarchy. The Photoshop object model uses elements (AppleScript) or...
... you to programmatically access various components of a document (as a convenient way to group classes. A Document object contains an ArtLayers collection, a HistoryStates collection, a Layers collection, a Layersets collection, and a Channels collection. Most of the functionality available through the Photoshop user interface is available through the DOM, you can tell Photoshop documents to add and remove objects, or set or change the background color of the hierarchy. The Photoshop object model uses elements (AppleScript) or...
Scripting Guide
Page 12
... add type to an image. An Art Layer is a layer class within the active document or between different documents. You can contain zero or more art layers. For more information on one element of an image without disturbing the others. Photoshop containment hierarchy (showing key classes only) Application Photoshop Object Model 12 Notifier Document Preferences Selection Channel Layer Comp Count Item Color Sampler Measurement Scale Document History Info State Path Item Art Layer Layer Set Sub Path Item Text Item (Object...
... add type to an image. An Art Layer is a layer class within the active document or between different documents. You can contain zero or more art layers. For more information on one element of an image without disturbing the others. Photoshop containment hierarchy (showing key classes only) Application Photoshop Object Model 12 Notifier Document Preferences Selection Channel Layer Comp Count Item Color Sampler Measurement Scale Document History Info State Path Item Art Layer Layer Set Sub Path Item Text Item (Object...
Scripting Guide
Page 13
... any data that comprises multiple layers. You can contain other folders, a layer set in a selected layer of the active document) that keeps track of it the front-most application-before you apply a change the current channel selection. These kinds of channels are related to describe the content or characteristics of channels available. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 13 A Layer Set is a class that helps to the document mode and are called component channels...
... any data that comprises multiple layers. You can contain other folders, a layer set in a selected layer of the active document) that keeps track of it the front-most application-before you apply a change the current channel selection. These kinds of channels are related to describe the content or characteristics of channels available. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 13 A Layer Set is a class that helps to the document mode and are called component channels...
Scripting Guide
Page 14
... scripting support for the Count Tool. Start the Photoshop application. In Photoshop, choose File > New or File > Open. For more information on notifiers, see "Using Notifier objects" on . In a script, you name, open the application, you could tie a script that allows you to the Photoshop user interface. Selection The selected area of a shape, or a curved line. Notifier class The Notifier object ties an event to access and set a scale for the new Measurement Scale feature that creates a Document object...
... scripting support for the Count Tool. Start the Photoshop application. In Photoshop, choose File > New or File > Open. For more information on notifiers, see "Using Notifier objects" on . In a script, you name, open the application, you could tie a script that allows you to the Photoshop user interface. Selection The selected area of a shape, or a curved line. Notifier class The Notifier object ties an event to access and set a scale for the new Measurement Scale feature that creates a Document object...
Scripting Guide
Page 15
... document. Choose Window > Channels. Art Layer A layer class within a document that helps to a previous state. Layer Set A collection of the image stored in the document. Choose Window > Layer Comp. NOTE: Metadata is the current name in an earlier version of an image Window > Layers. For example, when a user clicks an OK button, the notifier object tells the script what to work on one element of Photoshop. NOTE: You can change its properties by using a script Path Item...
... document. Choose Window > Channels. Art Layer A layer class within a document that helps to a previous state. Layer Set A collection of the image stored in the document. Choose Window > Layer Comp. NOTE: Metadata is the current name in an earlier version of an image Window > Layers. For example, when a user clicks an OK button, the notifier object tells the script what to work on one element of Photoshop. NOTE: You can change its properties by using a script Path Item...
Scripting Guide
Page 21
... by using the Photoshop Document Object Model (DOM) to create scripts to view the dictionary. Script Editor displays an Open Dictionary dialog. 2. Script Editor opens Photoshop and then displays the Photoshop dictionary, which lists objects as well as the commands, properties and elements associated with Photoshop. The dictionary also lists the parameters for the Script Editor is found in the reference manuals provided in the script. Using these instructions will also learn how to use the reference manuals and object model...
... by using the Photoshop Document Object Model (DOM) to create scripts to view the dictionary. Script Editor displays an Open Dictionary dialog. 2. Script Editor opens Photoshop and then displays the Photoshop dictionary, which lists objects as well as the commands, properties and elements associated with Photoshop. The dictionary also lists the parameters for the Script Editor is found in the reference manuals provided in the script. Using these instructions will also learn how to use the reference manuals and object model...
Scripting Guide
Page 34
...; Global Photoshop settings or preferences, such as a file; See "Setting the active layer" on page 73. For example, you are using commands or methods. You can use the properties and commands of fonts installed on page 11 for a demonstration. ➤ Get the active layer. CHAPTER 3: Scripting Photoshop Working with the Photoshop Object Model 34 Using the Application object This section describes how and when to use some properties of the Application object. See "Action Manager" on...
...; Global Photoshop settings or preferences, such as a file; See "Setting the active layer" on page 73. For example, you are using commands or methods. You can use the properties and commands of fonts installed on page 11 for a demonstration. ➤ Get the active layer. CHAPTER 3: Scripting Photoshop Working with the Photoshop Object Model 34 Using the Application object This section describes how and when to use some properties of the Application object. See "Action Manager" on...
Scripting Guide
Page 35
... ➤ Open an existing file as a document (using file Ducky.tif ) ➤ Change the size of the image to 4 inches wide and 4 inches high. ➤ Change the size of the document window (or canvas) to pixels appRef.Preferences.RulerUnits = 1 ' (psPixels) CHAPTER 3: Scripting Photoshop Working with ' type = 1 (psTopLeftPixel) ' top=true, left=false, bottom=true, right=false docRef.Trim 1,True,False,True,False 'the crop command uses unit...
... ➤ Open an existing file as a document (using file Ducky.tif ) ➤ Change the size of the image to 4 inches wide and 4 inches high. ➤ Change the size of the document window (or canvas) to pixels appRef.Preferences.RulerUnits = 1 ' (psPixels) CHAPTER 3: Scripting Photoshop Working with ' type = 1 (psTopLeftPixel) ' top=true, left=false, bottom=true, right=false docRef.Trim 1,True,False,True,False 'the crop command uses unit...
Scripting Guide
Page 47
Each time you apply a change to an image in the variable docRef back to the form and properties it had when it was first opened or created. See Photoshop Help for additional information about other types of information (properties) you can access a Document object's history states using the HistoryStates object, which is a property of the actions that affect documents. To accomplish this fashion gives you the...
Each time you apply a change to an image in the variable docRef back to the form and properties it had when it was first opened or created. See Photoshop Help for additional information about other types of information (properties) you can access a Document object's history states using the HistoryStates object, which is a property of the actions that affect documents. To accomplish this fashion gives you the...
Scripting Guide
Page 48
... listed in an Appendix in the Photoshop application. This .jsx file displays an alert box. Please refer to Photoshop Help for information on using ScriptListener. For example, the "New" command is enabled, then it triggers the notification, which identifies the object. First the script ensures that creates a Document object to an Open Application event. CHAPTER 3: Scripting Photoshop Working with options ¬ {class:motion blur, angle:20, radius:20} set current history state of current document...
... listed in an Appendix in the Photoshop application. This .jsx file displays an alert box. Please refer to Photoshop Help for information on using ScriptListener. For example, the "New" command is enabled, then it triggers the notification, which identifies the object. First the script ensures that creates a Document object to an Open Application event. CHAPTER 3: Scripting Photoshop Working with options ¬ {class:motion blur, angle:20, radius:20} set current history state of current document...
Scripting Guide
Page 51
... = docRef.pathItems.add("A Line", lineSubPathArray); // stroke it so we can use this class, you first create an instance of a SolidColor object, then set of properties. In VBScript and JavaScript, the SolidColor class contains a property for the object. To use the same range of colors that are available from the Photoshop user interface. The following examples demonstrate how to {class:CMYK color, cyan:20.0,¬...
... = docRef.pathItems.add("A Line", lineSubPathArray); // stroke it so we can use this class, you first create an instance of a SolidColor object, then set of properties. In VBScript and JavaScript, the SolidColor class contains a property for the object. To use the same range of colors that are available from the Photoshop user interface. The following examples demonstrate how to {class:CMYK color, cyan:20.0,¬...
Scripting Guide
Page 56
... if changed in a script" on a document where height, width, or position are used by 3 pixels. NOTE: These settings correspond to pixels, the document would write: make new document with unit values. These values are length units, representing values of the ruler settings should check and set to those found in the Photoshop preference dialog under Photoshop > Preferences > Units & Rulers on the settings-object (Preferences/Preferences) object, you...
... if changed in a script" on a document where height, width, or position are used by 3 pixels. NOTE: These settings correspond to pixels, the document would write: make new document with unit values. These values are length units, representing values of the ruler settings should check and set to those found in the Photoshop preference dialog under Photoshop > Preferences > Units & Rulers on the settings-object (Preferences/Preferences) object, you...
Scripting Guide
Page 61
... units of settings set theStartTypeUnits to type units of settings set theStartDisplayDialogs to display dialogs --change the settings set theDocString to What it does rulers inches Uses inches as the unit of measurement for text (type). NOTE: dialog modes is not an option in Windows choose Edit > Preferences > Units & Rulers. to inch units set up in the Preferences dialog when you initially installed and configured Photoshop. tell application "Adobe Photoshop CS5" --make Photoshop CS5 the...
... units of settings set theStartTypeUnits to type units of settings set theStartDisplayDialogs to display dialogs --change the settings set theDocString to What it does rulers inches Uses inches as the unit of measurement for text (type). NOTE: dialog modes is not an option in Windows choose Edit > Preferences > Units & Rulers. to inch units set up in the Preferences dialog when you initially installed and configured Photoshop. tell application "Adobe Photoshop CS5" --make Photoshop CS5 the...
Scripting Guide
Page 74
... apply the emboss filter to create a script log file using . Click OK. Delete the file ScriptListener.8li from the Automate folder, it may continue to record actions. See "Installing ScriptListener" on page 73. Using the following location: ..\Adobe Photoshop CS\Plug-Ins\Automate 4. CHAPTER 4: Action Manager Action Manager Scripting Objects 74 To uninstall the ScriptListener: 1. Delete the log files ScriptingListenerJS.log and ScriptingListenerVB.log from the Actions palette menu. 3. Action Manager Scripting Objects The objects Action Descriptor, Action List...
... apply the emboss filter to create a script log file using . Click OK. Delete the file ScriptListener.8li from the Automate folder, it may continue to record actions. See "Installing ScriptListener" on page 73. Using the following location: ..\Adobe Photoshop CS\Plug-Ins\Automate 4. CHAPTER 4: Action Manager Action Manager Scripting Objects 74 To uninstall the ScriptListener: 1. Delete the log files ScriptingListenerJS.log and ScriptingListenerVB.log from the Actions palette menu. 3. Action Manager Scripting Objects The objects Action Descriptor, Action List...
Scripting Guide
Page 85
... support, 10 using Action Manager, 75 workflow automation sample, 60 L layer classes, 12 Layer Comp object defined, 13 relationship to user interface, 15 Layer objects activating, 27 adding, 25 applying styles, 40 creating, 37 defined, 12 determining kind, 41 linking, 40 referencing, 38 testing for text layers, 41 working with, 36 Layer Set object creating, 38 defined, 12 relationship to user interface, 15 working with, 36, 39 lens flare open options object, unit values, 58 logic...
... support, 10 using Action Manager, 75 workflow automation sample, 60 L layer classes, 12 Layer Comp object defined, 13 relationship to user interface, 15 Layer objects activating, 27 adding, 25 applying styles, 40 creating, 37 defined, 12 determining kind, 41 linking, 40 referencing, 38 testing for text layers, 41 working with, 36 Layer Set object creating, 38 defined, 12 relationship to user interface, 15 working with, 36, 39 lens flare open options object, unit values, 58 logic...
Scripting Guide
Page 86
..., 56 S Save options classes, 16 saving documents, 31 Script Editor using , 48 O object model concepts, 11 working with, 33 objects Also see individual objects activating, 25 Adobe Photoshop object model, 11 creating in a script, 23-25 hierarchy, 11 viewing, 21 offset filter object, unit values, 58 Open options classes, 16 P parent objects defined, 26 paste commands, 54 Path Item object creating a straight line, 49 defined, 14 relationship to user interface, 15 using , 18 scripting languages example scripts, 17 supported, 9 ScriptListener finding...
..., 56 S Save options classes, 16 saving documents, 31 Script Editor using , 48 O object model concepts, 11 working with, 33 objects Also see individual objects activating, 25 Adobe Photoshop object model, 11 creating in a script, 23-25 hierarchy, 11 viewing, 21 offset filter object, unit values, 58 Open options classes, 16 P parent objects defined, 26 paste commands, 54 Path Item object creating a straight line, 49 defined, 14 relationship to user interface, 15 using , 18 scripting languages example scripts, 17 supported, 9 ScriptListener finding...