Scripting Guide
Page 2
... Suite® 4 Photoshop® Scripting Guide Adobe, the Adobe logo, Illustrator, and Photoshop are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries. Microsoft and Windows are the property of such license. Adobe Systems Inc., 345 Park Avenue, San Jose,... Computer, Inc., registered in the United States and/or other countries. All other countries. Apple and Mac OS are trademarks or registered trademarks of Adobe Systems Inc. in this document is furnished for any errors or inaccuracies that may only be construed as...
... Suite® 4 Photoshop® Scripting Guide Adobe, the Adobe logo, Illustrator, and Photoshop are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries. Microsoft and Windows are the property of such license. Adobe Systems Inc., 345 Park Avenue, San Jose,... Computer, Inc., registered in the United States and/or other countries. All other countries. Apple and Mac OS are trademarks or registered trademarks of Adobe Systems Inc. in this document is furnished for any errors or inaccuracies that may only be construed as...
Scripting Guide
Page 3
...Notifier class 14 Count Item class 14 Color Sampler class 14 Measurement Scale class 14 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 ...
...Notifier class 14 Count Item class 14 Color Sampler class 14 Measurement Scale class 14 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 ...
Scripting Guide
Page 4
... 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...
... 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...
Scripting Guide
Page 6
... about using the Extend Script Object Model Viewer, see the JavaScript Tools Guide. See "Viewing Photoshop's AppleScript dictionary" on page 21 and "Viewing Photoshop's type library (VBS)" on Mac OS® and Windows®. Chapter 4 covers the Action Manager, which allows you to ...Code and specific language samples appear in this manual. 1 Introduction About this Manual This manual provides an introduction to scripting Adobe® Photoshop® CS4 on page 22. Chapter 1 covers the basic conventions used in monospaced courier font: app.documents.add Several conventions are...
... about using the Extend Script Object Model Viewer, see the JavaScript Tools Guide. See "Viewing Photoshop's AppleScript dictionary" on page 21 and "Viewing Photoshop's type library (VBS)" on Mac OS® and Windows®. Chapter 4 covers the Action Manager, which allows you to ...Code and specific language samples appear in this manual. 1 Introduction About this Manual This manual provides an introduction to scripting Adobe® Photoshop® CS4 on page 22. Chapter 1 covers the basic conventions used in monospaced courier font: app.documents.add Several conventions are...
Scripting Guide
Page 8
... to Scripting manual. Scripts automate repetitive tasks and are often used as applying different filters to skip much of this installation: Adobe Photoshop CS4 AppleScript Scripting Reference, Adobe Photoshop CS4 Visual Basic Scripting Reference, and Adobe Photoshop CS4 JavaScript Scripting Reference. Scripting allows you to add functionality that is a series of commands that is most likely will want to...
... to Scripting manual. Scripts automate repetitive tasks and are often used as applying different filters to skip much of this installation: Adobe Photoshop CS4 AppleScript Scripting Reference, Adobe Photoshop CS4 Visual Basic Scripting Reference, and Adobe Photoshop CS4 JavaScript Scripting Reference. Scripting allows you to add functionality that is a series of commands that is most likely will want to...
Scripting Guide
Page 9
...VBS" on it, a script with the .js extension is no difference between using the .js and .jsx extension. On the Mac OS, there is interpreted with Adobe applications, see Introduction to Scripting. See "Executing JavaScripts from AppleScript and VBScript scripts. On Windows, if the script files is opened ...information on the scripting language you are using, you can use , and for file paths. However, if the script is launched by Photoshop as Adobe Illustrator® CS4, in an image: "If the selected area is smaller than 2 x 4 inches, add a green border; For example, depending on...
...VBS" on it, a script with the .js extension is no difference between using the .js and .jsx extension. On the Mac OS, there is interpreted with Adobe applications, see Introduction to Scripting. See "Executing JavaScripts from AppleScript and VBScript scripts. On Windows, if the script files is opened ...information on the scripting language you are using, you can use , and for file paths. However, if the script is launched by Photoshop as Adobe Illustrator® CS4, in an image: "If the selected area is smaller than 2 x 4 inches, add a green border; For example, depending on...
Scripting Guide
Page 10
... scripts that it finds in the startup folders. ➤ On Windows, the startup folder for user-defined scripts is: C:\Program Files\Common Files\Adobe\Startup Scripts CS4\Adobe Photoshop ➤ On Mac OS, the startup folder for execution. Executing JavaScripts from AS or VBS You can take advantage of the scripts in the Scripts folder...
... scripts that it finds in the startup folders. ➤ On Windows, the startup folder for user-defined scripts is: C:\Program Files\Common Files\Adobe\Startup Scripts CS4\Adobe Photoshop ➤ On Mac OS, the startup folder for execution. Executing JavaScripts from AS or VBS You can take advantage of the scripts in the Scripts folder...
Scripting Guide
Page 11
..., a HistoryStates collection, a Layers collection, a Layersets collection, and a Channels collection. For example, through the DOM, you can tell Photoshop documents to Scripting for that application) through the DOM. Through using commands or methods in it, and the components of a layer. The... available through the Photoshop user interface is a containment hierarchy, which index from 1 rather than 0. See Introduction to add and remove objects, or set or change the background color of the documents. For additional information about Adobe object models and ...
..., a HistoryStates collection, a Layers collection, a Layersets collection, and a Channels collection. For example, through the DOM, you can tell Photoshop documents to Scripting for that application) through the DOM. Through using commands or methods in it, and the components of a layer. The... available through the Photoshop user interface is a containment hierarchy, which index from 1 rather than 0. See Introduction to add and remove objects, or set or change the background color of the documents. For additional information about Adobe object models and ...
Scripting Guide
Page 12
...Set. You can change the composition of layers: an Art Layer that can contain image contents and a Layer Set that comprise it. CHAPTER 2: Photoshop Scripting Basics . The Document class is used to make modifications to get the active layer, then, save the current document, and copy and ...Path Item Text Item (Object) Path Point Layer Set Art Layer Application and document classes The Application class is implemented as a property of the Photoshop object model hierarchy. Scripts must target the appropriate application in a Script" on page 23 and "Using the Document object" on page 41....
...Set. You can change the composition of layers: an Art Layer that can contain image contents and a Layer Set that comprise it. CHAPTER 2: Photoshop Scripting Basics . The Document class is used to make modifications to get the active layer, then, save the current document, and copy and ...Path Item Text Item (Object) Path Point Layer Set Art Layer Application and document classes The Application class is implemented as a property of the Photoshop object model hierarchy. Scripts must target the appropriate application in a Script" on page 23 and "Using the Document object" on page 41....
Scripting Guide
Page 13
...of it the front-most application-before you want to work with layer objects" on page 46. In addition to the component channels, Photoshop lets you to create, manage, and view multiple versions of a Channel object, you create a document and then immediately try to get history ...on history objects, see "Using the Document Info object" on your desktop. A history state can create, delete and duplicate channels. You must first activate Photoshop-make it as a folder on page 47. NOTE: In AppleScript, if you can also be used to store pixel information about a document. Since ...
...of it the front-most application-before you want to work with layer objects" on page 46. In addition to the component channels, Photoshop lets you to create, manage, and view multiple versions of a Channel object, you create a document and then immediately try to get history ...on history objects, see "Using the Document Info object" on your desktop. A history state can create, delete and duplicate channels. You must first activate Photoshop-make it as a folder on page 47. NOTE: In AppleScript, if you can also be used to store pixel information about a document. Since ...
Scripting Guide
Page 14
... Measurement Scale object provides scripting support for your mouse. Object name Description To create this object without using a script Application The Photoshop application. In a script, you name, open the application, you could tie a script that allows you create layers, channels,...new Measurement Scale feature that creates a Document object to a script. See "Working with document preferences" on page 48. Start the Photoshop application. Selection The selected area of a shape, or a curved line. Color Sampler class The Color Sampler object provides scripting support...
... Measurement Scale object provides scripting support for your mouse. Object name Description To create this object without using a script Application The Photoshop application. In a script, you name, open the application, you could tie a script that allows you create layers, channels,...new Measurement Scale feature that creates a Document object to a script. See "Working with document preferences" on page 48. Start the Photoshop application. Selection The selected area of a shape, or a curved line. Color Sampler class The Color Sampler object provides scripting support...
Scripting Guide
Page 15
...> Script Events Manager. Color Sampler Represents a color sampler in your Scale document. NOTE: Metadata is the current name in the Photoshop UI. History State Stores a version of the document in the state the document was the name used in an earlier version of ... The application preference settings. Choose the Color Sampler Tool, and click in Mac OS. Document Info Metadata about an image's color. Choose Layer > New > Group. Choose Edit > Preferences in Windows, or Photoshop > Preferences in the document. Then select the New Layer Comp icon. Measurement...
...> Script Events Manager. Color Sampler Represents a color sampler in your Scale document. NOTE: Metadata is the current name in the Photoshop UI. History State Stores a version of the document in the state the document was the name used in an earlier version of ... The application preference settings. Choose the Color Sampler Tool, and click in Mac OS. Document Info Metadata about an image's color. Choose Layer > New > Group. Choose Edit > Preferences in Windows, or Photoshop > Preferences in the document. Then select the New Layer Comp icon. Measurement...
Scripting Guide
Page 16
...scripting engine. For example, with different constant values. For example, look up the art ArtLayer object in either the Adobe Photoshop CS4 JavaScript Scripting Reference or in the containment hierarchy above. The value type for JavaScript, the constant is Kind( kind)....save options for the Art Layer object's kind property. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 16 Additional objects The Photoshop object model includes additional objects beyond the ones described in the Adobe Photoshop CS4 Visual Basic Scripting Reference. NOTE: Different objects can define only ...
...scripting engine. For example, with different constant values. For example, look up the art ArtLayer object in either the Adobe Photoshop CS4 JavaScript Scripting Reference or in the containment hierarchy above. The value type for JavaScript, the constant is Kind( kind)....save options for the Art Layer object's kind property. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 16 Additional objects The Photoshop object model includes additional objects beyond the ones described in the Adobe Photoshop CS4 Visual Basic Scripting Reference. NOTE: Different objects can define only ...
Scripting Guide
Page 17
... thing to the document as a text item. 5. In fact, because this is the display of docRef. Application Document Art Layer Text Item Open the Photoshop application. 2. CHAPTER 2: Photoshop Scripting Basics Creating a sample Hello World script 17 Creating a sample Hello World script This section demonstrates a very simple script in each of artLayerRef. 4. When... will also create a variable named docRef and then assign a reference to accomplish in the containment hierarchy, as the value of the three scripting languages for Photoshop.
... thing to the document as a text item. 5. In fact, because this is the display of docRef. Application Document Art Layer Text Item Open the Photoshop application. 2. CHAPTER 2: Photoshop Scripting Basics Creating a sample Hello World script 17 Creating a sample Hello World script This section demonstrates a very simple script in each of artLayerRef. 4. When... will also create a variable named docRef and then assign a reference to accomplish in the containment hierarchy, as the value of the three scripting languages for Photoshop.
Scripting Guide
Page 18
... layer -- To create and run the script. set its contents. --target Photoshop CS4 tell application "Adobe Photoshop CS4" -- NOTE: The default location for the Script Editor is optional. -- Change the art layer to the text object and set kind of artLayerRef to run your first Photoshop AppleScript: 1. Get a reference to be a text layer. Create a new document...
... layer -- To create and run the script. set its contents. --target Photoshop CS4 tell application "Adobe Photoshop CS4" -- NOTE: The default location for the Script Editor is optional. -- Change the art layer to the text object and set kind of artLayerRef to run your first Photoshop AppleScript: 1. Get a reference to be a text layer. Create a new document...
Scripting Guide
Page 19
... Explorer to run a VBScript that manipulate Photoshop from anywhere in your first Photoshop VBScript: 1. in a Photoshop document. Save file as a text file with Photoshop. The script opens Photoshop. CHAPTER 2: Photoshop Scripting Basics Creating a sample Hello World ...script 19 Creating and running a JavaScript Follow these steps to create and run the script. NOTE: Adobe...
... Explorer to run a VBScript that manipulate Photoshop from anywhere in your first Photoshop VBScript: 1. in a Photoshop document. Save file as a text file with Photoshop. The script opens Photoshop. CHAPTER 2: Photoshop Scripting Basics Creating a sample Hello World ...script 19 Creating and running a JavaScript Follow these steps to create and run the script. NOTE: Adobe...
Scripting Guide
Page 20
...20 To create and run your Adobe Photoshop CS4 directory. The scripts do not appear on the File > Scripts menu until you restart the application. Save file as a text file with a .jsx file name extension in the Presets/Scripts folder in Photoshop. Do either of the text ...docRef.artLayers.add() artLayerRef.kind = LayerKind.TEXT // Set the contents of the following script. NOTE: Photoshop also supports JavaScript files that use a .js extension. 3. Type the following : ➣ If Photoshop is already open, choose File > Scripts > Browse, and then navigate to make the scripts accessible ...
...20 To create and run your Adobe Photoshop CS4 directory. The scripts do not appear on the File > Scripts menu until you restart the application. Save file as a text file with a .jsx file name extension in the Presets/Scripts folder in Photoshop. Do either of the text ...docRef.artLayers.add() artLayerRef.kind = LayerKind.TEXT // Set the contents of the following script. NOTE: Photoshop also supports JavaScript files that use a .js extension. 3. Type the following : ➣ If Photoshop is already open, choose File > Scripts > Browse, and then navigate to make the scripts accessible ...
Scripting Guide
Page 21
... in Visual Basic, or Visual Studio. ➤ For JavaScript, use the ExtendScript Object Model Viewer. 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 use Apple's Script Editor application to find information about the specific elements used in...
... in Visual Basic, or Visual Studio. ➤ For JavaScript, use the ExtendScript Object Model Viewer. 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 use Apple's Script Editor application to find information about the specific elements used in...
Scripting Guide
Page 22
... Object Because you run your AppleScript and VBScript scripts from the Photoshop application itself. (See "Creating and running a JavaScript" on page 19.) Select View > Object Browser. 3. On the COM tab, find "Adobe Photoshop CS4 Object Library". Click OK. 7. To view the VBS object ...library in the "Selected Projects and Components" portion of the window. 6. You can use the object browser in Photoshop. Start Word, and then choose Tools > Macro >...
... Object Because you run your AppleScript and VBScript scripts from the Photoshop application itself. (See "Creating and running a JavaScript" on page 19.) Select View > Object Browser. 3. On the COM tab, find "Adobe Photoshop CS4 Object Library". Click OK. 7. To view the VBS object ...library in the "Selected Projects and Components" portion of the window. 6. You can use the object browser in Photoshop. Start Word, and then choose Tools > Macro >...
Scripting Guide
Page 23
...menu or choose the New icon on elements and collections. Creating New Objects in a Script To create a new document in the Photoshop application, you to reference the Application object throughout the script. For example, you add a document to the art layers collection. ... object's collection name to create and then use the following statements: tell application "Adobe Photoshop CS4" ... VBS In VBScript, do the following to target the application: Dim appRef Set appRef = CreateObject("Photoshop.Application") JS In JavaScript, because you do not need to read. end tell ...
...menu or choose the New icon on elements and collections. Creating New Objects in a Script To create a new document in the Photoshop application, you to reference the Application object throughout the script. For example, you add a document to the art layers collection. ... object's collection name to create and then use the following statements: tell application "Adobe Photoshop CS4" ... VBS In VBScript, do the following to target the application: Dim appRef Set appRef = CreateObject("Photoshop.Application") JS In JavaScript, because you do not need to read. end tell ...