Scripting Guide
Page 3
... Manual 6 Conventions in this Guide 6 2 Photoshop Scripting Basics 8 Scripting Overview 8 Why use scripts instead of actions 8 Scripting Support in Photoshop 9 JavaScript support 9 Executing other scripts 10 Startup scripts 10 Executing JavaScripts from AS or VBS 10 Photoshop Object Model 11 Containment hierarchy 11 Application and document classes 12 Layer classes 12 Layer Comp class 13 Channel class 13 Selection class 13 History State class 13 Document Info class 13 Path Item, Sub Path Item, and Path Point...
... Manual 6 Conventions in this Guide 6 2 Photoshop Scripting Basics 8 Scripting Overview 8 Why use scripts instead of actions 8 Scripting Support in Photoshop 9 JavaScript support 9 Executing other scripts 10 Startup scripts 10 Executing JavaScripts from AS or VBS 10 Photoshop Object Model 11 Containment hierarchy 11 Application and document classes 12 Layer classes 12 Layer Comp class 13 Channel class 13 Selection class 13 History State class 13 Document Info class 13 Path Item, Sub Path Item, and Path Point...
Scripting Guide
Page 4
... 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 Determining a layer's kind 41 Adding and manipulating text in a Text Item object 42 Working with Selection objects 42 Creating and defining a selection 43 Stroking the selection border 44 Inverting selections 44 Expanding, contracting, and feathering selections 44 Filling a selection 45 Loading and storing selections 45 Working with Channel objects 46 Changing channel types 46 Using the Document Info object...
... 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 Determining a layer's kind 41 Adding and manipulating text in a Text Item object 42 Working with Selection objects 42 Creating and defining a selection 43 Stroking the selection border 44 Inverting selections 44 Expanding, contracting, and feathering selections 44 Filling a selection 45 Loading and storing selections 45 Working with Channel objects 46 Changing channel types 46 Using the Document Info object...
Scripting Guide
Page 6
... and commands, this installation, or through the object browsers available for each of these languages through the Scripting Reference Manuals provided with Photoshop for that is not otherwise accessible in VBScript and JavaScript. For example: "The display dialogs (DisplayDialogs/displayDialogs) property is provided for scripting the Photoshop application. Code examples are provided in this Guide Code and specific language samples appear in monospaced courier font: app.documents.add Several conventions are used...
... and commands, this installation, or through the object browsers available for each of these languages through the Scripting Reference Manuals provided with Photoshop for that is not otherwise accessible in VBScript and JavaScript. For example: "The display dialogs (DisplayDialogs/displayDialogs) property is provided for scripting the Photoshop application. Code examples are provided in this Guide Code and specific language samples appear in monospaced courier font: app.documents.add Several conventions are used...
Scripting Guide
Page 8
... various color profiles used as applying different filters to selections in an open document. For example, you could write a script to generate a number of localized versions of a particular image or to streamline tasks that the script automatically makes "decisions" based on page 21. For example, you . ➤ For more information on the Photoshop object model, see Chapter 3, "Scripting Photoshop" on page 21. ➤ For detailed information on Photoshop objects and commands, please use scripts instead...
... various color profiles used as applying different filters to selections in an open document. For example, you could write a script to generate a number of localized versions of a particular image or to streamline tasks that the script automatically makes "decisions" based on page 21. For example, you . ➤ For more information on the Photoshop object model, see Chapter 3, "Scripting Photoshop" on page 21. ➤ For detailed information on Photoshop objects and commands, please use scripts instead...
Scripting Guide
Page 11
..., a Layers collection, a Layersets collection, and a Channels collection. For additional information about Adobe object models and the scripting languages that application) through the DOM. The DOM allows you to other VBScript arrays, which index from 1 rather than 0. Through using commands or methods in contrast to programmatically access and manipulate the document and its documents will make script writing easier. The Photoshop object model uses elements (AppleScript) or collections (VBScript, JavaScript...
..., a Layers collection, a Layersets collection, and a Channels collection. For additional information about Adobe object models and the scripting languages that application) through the DOM. The DOM allows you to other VBScript arrays, which index from 1 rather than 0. Through using commands or methods in contrast to programmatically access and manipulate the document and its documents will make script writing easier. The Photoshop object model uses elements (AppleScript) or collections (VBScript, JavaScript...
Scripting Guide
Page 12
... different documents. Scripts must target the appropriate application in a Script" on page 23 and "Using the Document object" on page 22. For more art layers. For more information on text items, see "Creating New Objects in order to get the active layer, then, save the current document, and copy and paste within a document that can change the composition of an image by changing the order and attributes of multiple layers, defined by a Layer Set. CHAPTER 2: Photoshop Scripting...
... different documents. Scripts must target the appropriate application in a Script" on page 23 and "Using the Document object" on page 22. For more art layers. For more information on text items, see "Creating New Objects in order to get the active layer, then, save the current document, and copy and paste within a document that can change the composition of an image by changing the order and attributes of multiple layers, defined by a Layer Set. CHAPTER 2: Photoshop Scripting...
Scripting Guide
Page 13
... palette. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 13 A Layer Set is recursive. That is added to fill a selection. Image color determines the number of a Channel object, you apply a change the current channel selection. An RGB image, for example, has four default channels: one for editing the entire image. Using the commands or methods of channels available. For more information on history objects, see "Working with Channel objects" on your desktop. Each time you can access history states. A history...
... palette. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 13 A Layer Set is recursive. That is added to fill a selection. Image color determines the number of a Channel object, you apply a change the current channel selection. An RGB image, for example, has four default channels: one for editing the entire image. Using the commands or methods of channels available. For more information on history objects, see "Working with Channel objects" on your desktop. Each time you can access history states. A history...
Scripting Guide
Page 14
... create a new document when you to an Open Application event. For example, if you would like Photoshop to access and set a scale for the new Measurement Scale feature that creates a Document object to set the user preference settings. Color Sampler class The Color Sampler object provides scripting support for the Count Tool. Start the Photoshop application. Count Item class The Count Item object provides scripting support for the Color Sampler Tool. The Path Point class contains information about a drawing object, such as you would a file...
... create a new document when you to an Open Application event. For example, if you would like Photoshop to access and set a scale for the new Measurement Scale feature that creates a Document object to set the user preference settings. Color Sampler class The Color Sampler object provides scripting support for the Count Tool. Start the Photoshop application. Count Item class The Count Item object provides scripting support for the Color Sampler Tool. The Path Point class contains information about a drawing object, such as you would a file...
Scripting Guide
Page 15
... a Selection object or to reset the document to work on one element of the image stored in the file, etc. Group is any data that allows Choose Layer > New > Layer or you saved it. Choose File > File Info. Notifier Notifies a script when an event occurs; NOTE: You can change its properties by using a script Path Item A drawing object, such as the outline of Art Layer objects. Layer Comp A snapshot of a state of Photoshop. Color Sampler Represents a color...
... a Selection object or to reset the document to work on one element of the image stored in the file, etc. Group is any data that allows Choose Layer > New > Layer or you saved it. Choose File > File Info. Notifier Notifies a script when an event occurs; NOTE: You can change its properties by using a script Path Item A drawing object, such as the outline of Art Layer objects. Layer Comp A snapshot of a state of Photoshop. Color Sampler Represents a color...
Scripting Guide
Page 21
...create a script is followed by using the Photoshop Document Object Model (DOM) to create scripts to use specifically with each command. 21 The dictionary also lists the parameters for each object. Choose Adobe Photoshop CS4, and then click Open. To view the AppleScript dictionary: 1. TIP: Throughout this installation: ➤ Adobe Photoshop CS4 AppleScript Scripting Reference ➤ Adobe Photoshop CS4 Visual Basic Scripting Reference ➤ Adobe Photoshop CS4 JavaScript Scripting Reference In addition, you can also access reference material by instructions for locating...
...create a script is followed by using the Photoshop Document Object Model (DOM) to create scripts to use specifically with each command. 21 The dictionary also lists the parameters for each object. Choose Adobe Photoshop CS4, and then click Open. To view the AppleScript dictionary: 1. TIP: Throughout this installation: ➤ Adobe Photoshop CS4 AppleScript Scripting Reference ➤ Adobe Photoshop CS4 Visual Basic Scripting Reference ➤ Adobe Photoshop CS4 JavaScript Scripting Reference In addition, you can also access reference material by instructions for locating...
Scripting Guide
Page 24
... statement creates a Document object in AppleScript, you actually add the object to an element the same way you must use the collection name, which creates a Document object: appRef.Document.Add() You must reference the Application object when creating when creating, or referring to a new document. For example, to say, the first document created has index 1, rather than a document, you can use the set commands in the Adobe Photoshop CS4 AppleScript Scripting Reference or in the following sample references the Application object using...
... statement creates a Document object in AppleScript, you actually add the object to an element the same way you must use the collection name, which creates a Document object: appRef.Document.Add() You must reference the Application object when creating when creating, or referring to a new document. For example, to say, the first document created has index 1, rather than a document, you can use the set commands in the Adobe Photoshop CS4 AppleScript Scripting Reference or in the following sample references the Application object using...
Scripting Guide
Page 27
... Document object in the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the ExtendScript Object Model Viewer. NOTE: You can also use the name of current document NOTE: By default, Photoshop names the layers "Layer 1", "Layer2", etc. By default, Photoshop names the layers "Layer 1", "Layer2". Then, you could //make docRef the active document app.activeDocument = docRef //here you would include command statements //that contains at least one layer. See "Referencing ArtLayer objects...
... Document object in the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the ExtendScript Object Model Viewer. NOTE: You can also use the name of current document NOTE: By default, Photoshop names the layers "Layer 1", "Layer2", etc. By default, Photoshop names the layers "Layer 1", "Layer2". Then, you could //make docRef the active document app.activeDocument = docRef //here you would include command statements //that contains at least one layer. See "Referencing ArtLayer objects...
Scripting Guide
Page 33
... can use. Working with the Photoshop Object Model This section contains information about using stops in an unsupervised (batch) mode, you have a script that , because DisplayDialogs is a property of the settings properties you use the display dialogs (DisplayDialogs/displayDialogs) property of the Application object. For information on object models, see the value type for the display dialogs property. displayDialogs = DialogModes.NO In the Adobe Photoshop CS4 JavaScript Scripting Reference, or in the Photoshop Object Model. CHAPTER 3: Scripting Photoshop...
... can use. Working with the Photoshop Object Model This section contains information about using stops in an unsupervised (batch) mode, you have a script that , because DisplayDialogs is a property of the settings properties you use the display dialogs (DisplayDialogs/displayDialogs) property of the Application object. For information on object models, see the value type for the display dialogs property. displayDialogs = DialogModes.NO In the Adobe Photoshop CS4 JavaScript Scripting Reference, or in the Photoshop Object Model. CHAPTER 3: Scripting Photoshop...
Scripting Guide
Page 34
... page 31. ➤ Copy and paste within the active document or between different documents. See "Saving a Document" on page 54. You work with Photoshop functionality and objects such as the following : ➤ Access script objects contained in the Photoshop application. See "Setting the active layer" on page 73. See "Action Manager" on page 27. ➤ Save the current document. CHAPTER 3: Scripting Photoshop Working with the Document object to use some properties of the Application object.
... page 31. ➤ Copy and paste within the active document or between different documents. See "Saving a Document" on page 54. You work with Photoshop functionality and objects such as the following : ➤ Access script objects contained in the Photoshop application. See "Setting the active layer" on page 73. See "Action Manager" on page 27. ➤ Save the current document. CHAPTER 3: Scripting Photoshop Working with the Document object to use some properties of the Application object.
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 4 inches high and 4 inches wide. ➤ Trim the top and bottom of settings to inch units set duckFile to alias ¬ "OS X 10.4.8 US:Applications:Adobe Photoshop CS4:Samples:Ducky.tif" open duckFile set...
...; 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 4 inches high and 4 inches wide. ➤ Trim the top and bottom of settings to inch units set duckFile to alias ¬ "OS X 10.4.8 US:Applications:Adobe Photoshop CS4:Samples:Ducky.tif" open duckFile set...
Scripting Guide
Page 48
... the make (Add/add) command requires you would like Photoshop to trigger the execution of current document using motion blur with the Photoshop Object Model 48 AS set up notification for a class ID, which runs the .jsx file. Use the Purge command to remove later states from the history collection. AS set savedState to an Open Application event. See "Using ScriptListener to selecting Start Application in the Script Events Manager (File > Scripts > Script Events Manager) in the Adobe Photoshop CS4 JavaScript Scripting Reference, Adobe Photoshop CS4...
... the make (Add/add) command requires you would like Photoshop to trigger the execution of current document using motion blur with the Photoshop Object Model 48 AS set up notification for a class ID, which runs the .jsx file. Use the Purge command to remove later states from the history collection. AS set savedState to an Open Application event. See "Using ScriptListener to selecting Start Application in the Script Events Manager (File > Scripts > Script Events Manager) in the Adobe Photoshop CS4 JavaScript Scripting Reference, Adobe Photoshop CS4...
Scripting Guide
Page 56
... graphical layout measurements or operations on setting unit values. After executing a script the original values of linear measurement. For example, to pixels, the document would write: make new document with an explicit unit type where unit values are length units, representing values of the ruler settings should check and set to create a document which is active when using the ruler units (RulerUnits/rulerUnits) property...
... graphical layout measurements or operations on setting unit values. After executing a script the original values of linear measurement. For example, to pixels, the document would write: make new document with an explicit unit type where unit values are length units, representing values of the ruler settings should check and set to create a document which is active when using the ruler units (RulerUnits/rulerUnits) property...
Scripting Guide
Page 61
...; Finally, the script restores the original preferences. NOTE: dialog modes is not an option in Windows choose Edit > Preferences > Units & Rulers. Create and run the following values: Preference Set to the following script. units pixels Uses pixels as clicking an OK button) at various stages of measurement for details. in the Photoshop application. CHAPTER 3: Scripting Photoshop Advanced Scripting 61 Working with document preferences: 1. These are the default configurations you probably set...
...; Finally, the script restores the original preferences. NOTE: dialog modes is not an option in Windows choose Edit > Preferences > Units & Rulers. Create and run the following values: Preference Set to the following script. units pixels Uses pixels as clicking an OK button) at various stages of measurement for details. in the Photoshop application. CHAPTER 3: Scripting Photoshop Advanced Scripting 61 Working with document preferences: 1. These are the default configurations you probably set...
Scripting Guide
Page 74
.... Verify that a copy of the Action Manager functionality. Choose Window > Actions, then choose New Action from your desktop. Recording a Script using ScriptListener The section demonstrates how to create a script log file using . Action Manager Scripting Objects The objects Action Descriptor, Action List, and Action Reference are part of the file ScriptListener.8li still exists in AppleScript. Open Photoshop, then open a document. 2. Name the action, then click Record. 4. Close Photoshop. 2. NOTE: These objects are using ScriptListener. We...
.... Verify that a copy of the Action Manager functionality. Choose Window > Actions, then choose New Action from your desktop. Recording a Script using ScriptListener The section demonstrates how to create a script log file using . Action Manager Scripting Objects The objects Action Descriptor, Action List, and Action Reference are part of the file ScriptListener.8li still exists in AppleScript. Open Photoshop, then open a document. 2. Name the action, then click Record. 4. Close Photoshop. 2. NOTE: These objects are using ScriptListener. We...
Scripting Guide
Page 85
..., 28 opening, 28 opening using specific settings, 29 saving, 31 specifying format, 29 filters additional, 54 applying motionblur, 71 applying wave, 66-70 making scriptable, 74 working with, 53 H Hello World script, 17-20 hex color values, setting, 52 hierarchy, 11 History State object defined, 13 purging, 48 relationship to user interface, 15 reverting, 48 using, 47 history states defined, 47 I images, changing composition, 12 J JavaScript conventions, 6 creating, 19...
..., 28 opening, 28 opening using specific settings, 29 saving, 31 specifying format, 29 filters additional, 54 applying motionblur, 71 applying wave, 66-70 making scriptable, 74 working with, 53 H Hello World script, 17-20 hex color values, setting, 52 hierarchy, 11 History State object defined, 13 purging, 48 relationship to user interface, 15 reverting, 48 using, 47 history states defined, 47 I images, changing composition, 12 J JavaScript conventions, 6 creating, 19...