Scripting Guide
Page 2
© 2010 Adobe Systems Incorporated. Adobe® Creative Suite® 5 Photoshop® Scripting Guide Adobe, the Adobe logo, Illustrator, and Photoshop are either registered trademarks or trademarks of such license. All other trademarks are trademarks or registered trademarks of Apple Computer, Inc., registered in the United ...
© 2010 Adobe Systems Incorporated. Adobe® Creative Suite® 5 Photoshop® Scripting Guide Adobe, the Adobe logo, Illustrator, and Photoshop are either registered trademarks or trademarks of such license. All other trademarks are trademarks or registered trademarks of Apple Computer, Inc., registered in the United ...
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
...JavaScript The term "commands" will be used when referring to execute scripts, and the Photoshop object model. Chapter 4 covers the Action Manager, which allows you to scripting Adobe® Photoshop® CS5 on page 22. Chapter 2 covers a brief overview of the Application object...." 6 Conventions in this installation, or through the Scripting Reference Manuals provided with Photoshop for that is part of scripting, how ...
...JavaScript The term "commands" will be used when referring to execute scripts, and the Photoshop object model. Chapter 4 covers the Action Manager, which allows you to scripting Adobe® Photoshop® CS5 on page 22. Chapter 2 covers a brief overview of the Application object...." 6 Conventions in this installation, or through the Scripting Reference Manuals provided with Photoshop for that is part of scripting, how ...
Scripting Guide
Page 8
... to add functionality that is a series of commands that might be too time consuming to skip much of this installation: Adobe Photoshop CS5 AppleScript Scripting Reference, Adobe Photoshop CS5 Visual Basic Scripting Reference, and Adobe Photoshop CS5 JavaScript Scripting Reference. Scripting allows you to extend those benefits by a collection of images. If you . ➤ For more...
... to add functionality that is a series of commands that might be too time consuming to skip much of this installation: Adobe Photoshop CS5 AppleScript Scripting Reference, Adobe Photoshop CS5 Visual Basic Scripting Reference, and Adobe Photoshop CS5 JavaScript Scripting Reference. Scripting allows you to extend those benefits by a collection of images. If you . ➤ For more...
Scripting Guide
Page 9
... For a JavaScript file to use variables for more versatility for additional information about how to choose which scripting language to be recognized by Photoshop as Adobe Illustrator® CS5, in the same script. ➤ You can open, save, and rename files using scripts. ➤ You... you were using an Action and then switched computers, you can copy scripts from inside Photoshop, there is no difference between using these languages with Adobe applications, see Introduction to another Adobe Creative Suite 5 Application, such as a valid script file it must hard code the ...
... For a JavaScript file to use variables for more versatility for additional information about how to choose which scripting language to be recognized by Photoshop as Adobe Illustrator® CS5, in the same script. ➤ You can open, save, and rename files using scripts. ➤ You... you were using an Action and then switched computers, you can copy scripts from inside Photoshop, there is no difference between using these languages with Adobe applications, see Introduction to another Adobe Creative Suite 5 Application, such as a valid script file it must hard code the ...
Scripting Guide
Page 10
... does not add a hierarchical organization to select a script file for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CS5/Adobe Photoshop If your JavaScripts. The addition of JavaScript's platform-independence by running do not appear in the Scripts menu until ...; On Windows, the startup folder for user-defined scripts is: C:\Program Files\Common Files\Adobe\Startup Scripts CS5\Adobe Photoshop ➤ On Mac OS, the startup folder for execution. Executing other Adobe Creative Suite 5 applications at the top level of the Scripts menu (File > Scripts >...
... does not add a hierarchical organization to select a script file for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CS5/Adobe Photoshop If your JavaScripts. The addition of JavaScript's platform-independence by running do not appear in the Scripts menu until ...; On Windows, the startup folder for user-defined scripts is: C:\Program Files\Common Files\Adobe\Startup Scripts CS5\Adobe Photoshop ➤ On Mac OS, the startup folder for execution. Executing other Adobe Creative Suite 5 applications at the top level of the Scripts menu (File > Scripts >...
Scripting Guide
Page 11
..., the documents used in Photoshop: Art Layers, Channels, Color Samplers, Count Items, Documents, Layers, Layer Comps, Layer Sets, History States, Notifiers, Path Items, Path Points Sub Path Items, and Text Fonts. For additional information about Adobe object models and the scripting languages that application) through the DOM. We have not shown object...
..., the documents used in Photoshop: Art Layers, Channels, Color Samplers, Count Items, Documents, Layers, Layer Comps, Layer Sets, History States, Notifiers, Path Items, Path Points Sub Path Items, and Text Fonts. For additional information about Adobe object models and the scripting languages that application) through the DOM. We have not shown object...
Scripting Guide
Page 12
... Document class is a particular type of the Photoshop object model hierarchy. Images are typically composed of the art layer. In Photoshop, a Text Item item is the root of art layer that comprise it. CHAPTER 2: Photoshop Scripting Basics . An Art Layer is a layer... document or between different documents. See "Targeting and Referencing the Application Object" on page 41. 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...
... Document class is a particular type of the Photoshop object model hierarchy. Images are typically composed of the art layer. In Photoshop, a Text Item item is the root of art layer that comprise it. CHAPTER 2: Photoshop Scripting Basics . An Art Layer is a layer... document or between different documents. See "Targeting and Referencing the Application Object" on page 41. 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...
Scripting Guide
Page 13
...active document) that keeps track of changes made to describe the content or characteristics of channels are called component channels. You must first activate Photoshop-make it as a folder on page 36. That is, one for editing the entire image. Each time you could choose to create,... to fill a selection. These kinds of a file. Think of that image is added to get history state, Photoshop returns an error. In addition to the component channels, Photoshop lets you create a document and then immediately try to the palette. You can also be used to store pixel...
...active document) that keeps track of changes made to describe the content or characteristics of channels are called component channels. You must first activate Photoshop-make it as a folder on page 36. That is, one for editing the entire image. Each time you could choose to create,... to fill a selection. These kinds of a file. Think of that image is added to get history state, Photoshop returns an error. In addition to the component channels, Photoshop lets you create a document and then immediately try to the palette. You can also be used to store pixel...
Scripting Guide
Page 14
...scripting support for the Color Sampler Tool. Object name Description To create this object without using a script Application The Photoshop application. Start the Photoshop application. Preferences class The Preferences class allows you could tie a script that allows you to set the user preference ...settings. For more information on notifiers, see "Using Notifier objects" on page 61. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 14 Path Item, Sub Path Item, and Path Point classes The Path Item class represents information about each object ...
...scripting support for the Color Sampler Tool. Object name Description To create this object without using a script Application The Photoshop application. Start the Photoshop application. Preferences class The Preferences class allows you could tie a script that allows you to set the user preference ...settings. For more information on notifiers, see "Using Notifier objects" on page 61. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 14 Path Item, Sub Path Item, and Path Point classes The Path Item class represents information about each object ...
Scripting Guide
Page 15
.... Document Info Metadata about an image's color. the event then triggers the script to work on one element of Photoshop. Choose Edit > Preferences in Windows, or Photoshop > Preferences in the document. Choose Window > History, and then choose a history state from the History palette. ..., author name, the name of the document in the state the document was the name used in a document. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 15 Object name Description To create this object without affecting other elements in the document. Art Layer A layer class ...
.... Document Info Metadata about an image's color. the event then triggers the script to work on one element of Photoshop. Choose Edit > Preferences in Windows, or Photoshop > Preferences in the document. Choose Window > History, and then choose a history state from the History palette. ..., author name, the name of the document in the state the document was the name used in a document. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 15 Object name Description To create this object without affecting other elements in the document. Art Layer A layer class ...
Scripting Guide
Page 16
...Scripting. NOTE: Throughout this object is Kind( kind). For example, look up the art ArtLayer object in either the Adobe Photoshop CS5 JavaScript Scripting Reference or in the containment hierarchy above. One of the properties of this document, actual values of enumerations...of the ' from being read by the scripting engine. 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 CS5 Visual Basic Scripting Reference. See "Working with the kind property...
...Scripting. NOTE: Throughout this object is Kind( kind). For example, look up the art ArtLayer object in either the Adobe Photoshop CS5 JavaScript Scripting Reference or in the containment hierarchy above. One of the properties of this document, actual values of enumerations...of the ' from being read by the scripting engine. 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 CS5 Visual Basic Scripting Reference. See "Working with the kind property...
Scripting Guide
Page 17
CHAPTER 2: Photoshop Scripting Basics Creating a sample Hello World script 17 Creating a sample Hello World script This section demonstrates a very...variable named artLayerRef and then assign a reference to accomplish in the containment hierarchy, as the value of the three scripting languages for Photoshop. In our script, we will also include comments throughout the scripts. Create an Art Layer object. In fact, because this is ... artLayerRef as the value of a "Hello World" message. NOTE: We will use comments to "Hello World". 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...variable named artLayerRef and then assign a reference to accomplish in the containment hierarchy, as the value of the three scripting languages for Photoshop. In our script, we will also include comments throughout the scripts. Create an Art Layer object. In fact, because this is ... artLayerRef as the value of a "Hello World" message. NOTE: We will use comments to "Hello World". Open the Photoshop application. 2.
Scripting Guide
Page 18
..., which has a section on AppleScript debugging. Get a reference to the text object and set kind of artLayerRef to run your first Photoshop AppleScript: 1. Photoshop creates a new document, adds a new layer, changes the layer's type to text and sets the text to "Hello, World" NOTE...to Introduction to be a text layer. NOTE: The default location for the Script Editor is optional. -- set its contents. --target Photoshop CS5 tell application "Adobe Photoshop CS5" -- Click Run to "Hello, World" end tell 2. To create and run the script. change its contents. set docRef to...
..., which has a section on AppleScript debugging. Get a reference to the text object and set kind of artLayerRef to run your first Photoshop AppleScript: 1. Photoshop creates a new document, adds a new layer, changes the layer's type to text and sets the text to "Hello, World" NOTE...to Introduction to be a text layer. NOTE: The default location for the Script Editor is optional. -- set its contents. --target Photoshop CS5 tell application "Adobe Photoshop CS5" -- Click Run to "Hello, World" end tell 2. To create and run the script. change its contents. set docRef to...
Scripting Guide
Page 19
... assign it is optional. NOTE: Adobe has created the Extend Script scripting language to augment JavaScript for more information. See the "Script UI" chapter of the text layer. To create and run your file system. Because you will be actually using Photoshop to run a VBScript that manipulate Photoshop from anywhere in Windows Explorer...
... assign it is optional. NOTE: Adobe has created the Extend Script scripting language to augment JavaScript for more information. See the "Script UI" chapter of the text layer. To create and run your file system. Because you will be actually using Photoshop to run a VBScript that manipulate Photoshop from anywhere in Windows Explorer...
Scripting Guide
Page 20
... ruler unit setting app.preferences.rulerUnits = originalUnit 2. NOTE: Photoshop also supports JavaScript files that use a .js extension. 3. CHAPTER 2: Photoshop Scripting Basics Creating a sample Hello World script 20 To create and run your Adobe Photoshop CS5 directory. NOTE: Entering comments is optional. // Hello ... restart the application. Save file as a text file with a .jsx file name extension in the Presets/Scripts folder in your first Photoshop JavaScript: 1. NOTE: You must place your script from the File > Scripts menu in order to a variable var docRef = app.documents...
... ruler unit setting app.preferences.rulerUnits = originalUnit 2. NOTE: Photoshop also supports JavaScript files that use a .js extension. 3. CHAPTER 2: Photoshop Scripting Basics Creating a sample Hello World script 20 To create and run your Adobe Photoshop CS5 directory. NOTE: Entering comments is optional. // Hello ... restart the application. Save file as a text file with a .jsx file name extension in the Presets/Scripts folder in your first Photoshop JavaScript: 1. NOTE: You must place your script from the File > Scripts menu in order to a variable var docRef = app.documents...
Scripting Guide
Page 21
See the JavaScript Tools Guide for the Script Editor is Applications > AppleScript > Script Editor. Choose Adobe Photoshop CS5, and then click Open. Script Editor displays an Open Dictionary dialog. 2. Using these instructions ...to view the dictionary. To view the AppleScript dictionary: 1. TIP: Throughout this installation: ➤ Adobe Photoshop CS5 AppleScript Scripting Reference ➤ Adobe Photoshop CS5 Visual Basic Scripting Reference ➤ Adobe Photoshop CS5 JavaScript Scripting Reference In addition, you quickly understand how to create a script is found in...
See the JavaScript Tools Guide for the Script Editor is Applications > AppleScript > Script Editor. Choose Adobe Photoshop CS5, and then click Open. Script Editor displays an Open Dictionary dialog. 2. Using these instructions ...to view the dictionary. To view the AppleScript dictionary: 1. TIP: Throughout this installation: ➤ Adobe Photoshop CS5 AppleScript Scripting Reference ➤ Adobe Photoshop CS5 Visual Basic Scripting Reference ➤ Adobe Photoshop CS5 JavaScript Scripting Reference In addition, you quickly understand how to create a script is found in...
Scripting Guide
Page 22
...the object browser. Choose View > Object Browser. 4. Choose Photoshop CS5 type library from the Photoshop application itself. (See "Creating and running a JavaScript" on page 19.) Choose Tools > References, and then select the Adobe Photoshop Type Library check box and click OK. 3. You can ...select one to the Photoshop Library icon. 8. On the COM tab, find "Adobe Photoshop CS5 Object Library". Select it. 5. Click on the plus sign next...
...the object browser. Choose View > Object Browser. 4. Choose Photoshop CS5 type library from the Photoshop application itself. (See "Creating and running a JavaScript" on page 19.) Choose Tools > References, and then select the Adobe Photoshop Type Library check box and click OK. 3. You can ...select one to the Photoshop Library icon. 8. On the COM tab, find "Adobe Photoshop CS5 Object Library". Select it. 5. Click on the plus sign next...
Scripting Guide
Page 23
... must reference the Document object when adding objects other than the class name. To reference the Application object, use the following statements: tell application "Adobe Photoshop CS5" ... Creating New Objects in a Script To create a new document in the following command: ➤ AS: make ➤ VBS: ... containment hierarchy or leave it out, whichever makes your script. (It is no need to read. You can see in the "Photoshop Object Model" on the appropriate palette. For example, you add a document to Scripting for you can reference the application as a layer...
... must reference the Document object when adding objects other than the class name. To reference the Application object, use the following statements: tell application "Adobe Photoshop CS5" ... Creating New Objects in a Script To create a new document in the following command: ➤ AS: make ➤ VBS: ... containment hierarchy or leave it out, whichever makes your script. (It is no need to read. You can see in the "Photoshop Object Model" on the appropriate palette. For example, you add a document to Scripting for you can reference the application as a layer...