Scripting Guide
Page 2
... of Sun Microsystems, Inc. The software described in the United States and other countries. Adobe Systems Inc., 345 Park Avenue, San Jose, California 95110, USA. Adobe Systems Inc. Adobe® Creative Suite® 4 Photoshop® Scripting Guide Adobe, the Adobe logo, Illustrator, and Photoshop are the property of Apple Computer, Inc., registered in this document. in this...
... of Sun Microsystems, Inc. The software described in the United States and other countries. Adobe Systems Inc., 345 Park Avenue, San Jose, California 95110, USA. Adobe Systems Inc. Adobe® Creative Suite® 4 Photoshop® Scripting Guide Adobe, the Adobe logo, Illustrator, and Photoshop are the property of Apple Computer, Inc., registered in this document. in this...
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
... the basic conventions used in parenthesis. For information about outstanding issues. See "Viewing Photoshop's AppleScript dictionary" on page 21 and "Viewing Photoshop's type library (VBS)" on Mac OS® and Windows®. When referring to scripting Adobe® Photoshop® CS4 on page 22. 1 Introduction About this manual. Chapter 4 covers the Action Manager... and commands, 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.
... the basic conventions used in parenthesis. For information about outstanding issues. See "Viewing Photoshop's AppleScript dictionary" on page 21 and "Viewing Photoshop's type library (VBS)" on Mac OS® and Windows®. When referring to scripting Adobe® Photoshop® CS4 on page 22. 1 Introduction About this manual. Chapter 4 covers the Action Manager... and commands, 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.
Scripting Guide
Page 8
... 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. It provides a simple example of how to execute scripts, and covers the Photoshop object model. If you are new to scripting, you can be too time consuming to extend those benefits by a collection of images...
... 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. It provides a simple example of how to execute scripts, and covers the Photoshop object model. If you are new to scripting, you can be too time consuming to extend those benefits by a collection of images...
Scripting Guide
Page 9
... Suite 4 Application, such as a valid script file it must hard code the file location. On Windows, if the script files is launched by Photoshop as Adobe Illustrator® CS4, in the same script. ➤ You can open, save, and rename files using scripts. ➤ You can perform actions that involve multiple applications. otherwise...
... Suite 4 Application, such as a valid script file it must hard code the file location. On Windows, if the script files is launched by Photoshop as Adobe Illustrator® CS4, in the same script. ➤ You can open, save, and rename files using scripts. ➤ You can perform actions that involve multiple applications. otherwise...
Scripting Guide
Page 10
...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. The addition of the scripts in the Scripts folder, without the file name... Scripts menu. You can also use Browse to select a script file for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CS4/Adobe Photoshop If your JavaScripts. Selecting Browse displays a file browser dialog which provides quick and easy access to be executed only by...
...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. The addition of the scripts in the Scripts folder, without the file name... Scripts menu. You can also use Browse to select a script file for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CS4/Adobe Photoshop If your JavaScripts. Selecting Browse displays a file browser dialog which provides quick and easy access to be executed only by...
Scripting Guide
Page 11
... Applications contain a Documents collection. However, some key classes are associated with a collection. NOTE: In Photoshop, VBScript collections index from 0. For additional information about Adobe object models and the scripting languages that application) through the DOM. A Document object contains an ArtLayers ...layer. The Documents collection contains Document objects. In the diagram below . We have not shown object elements or collections in Photoshop: Art Layers, Channels, Color Samplers, Count Items, Documents, Layers, Layer Comps, Layer Sets, History States, Notifiers, ...
... Applications contain a Documents collection. However, some key classes are associated with a collection. NOTE: In Photoshop, VBScript collections index from 0. For additional information about Adobe object models and the scripting languages that application) through the DOM. A Document object contains an ArtLayers ...layer. The Documents collection contains Document objects. In the diagram below . We have not shown object elements or collections in Photoshop: Art Layers, Channels, Color Samplers, Count Items, Documents, Layers, Layer Comps, Layer Sets, History States, Notifiers, ...
Scripting Guide
Page 12
...Application and document classes The Application class is a layer class within the active document or between different documents. Layer classes Photoshop has two types of multiple layers, defined by changing the order and attributes of art layer that comprise it. An Art.... See "Targeting and Referencing the Application Object" on page 41. The Document class is implemented as a property of the Photoshop object model hierarchy. CHAPTER 2: Photoshop Scripting Basics . For more information on page 34. You can change the composition of an image by a Layer Set. ...
...Application and document classes The Application class is a layer class within the active document or between different documents. Layer classes Photoshop has two types of multiple layers, defined by changing the order and attributes of art layer that comprise it. An Art.... See "Targeting and Referencing the Application Object" on page 41. The Document class is implemented as a property of the Photoshop object model hierarchy. CHAPTER 2: Photoshop Scripting Basics . For more information on page 34. You can change the composition of an image by a Layer Set. ...
Scripting Guide
Page 13
...can also retrieve a channel's histogram, change its kind or change to an image, the new state of that image is recursive. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 13 A Layer Set is used to specify an area of pixels in the active document (or in a selected layer of the ...active document) that you want to work with. Selection class The Selection class is a class that comprises multiple layers. You must first activate Photoshop-make it as a folder on page 47. For more information on history objects, see "Using the Document Info object" on page 46. ...
...can also retrieve a channel's histogram, change its kind or change to an image, the new state of that image is recursive. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 13 A Layer Set is used to specify an area of pixels in the active document (or in a selected layer of the ...active document) that you want to work with. Selection class The Selection class is a class that comprises multiple layers. You must first activate Photoshop-make it as a folder on page 47. For more information on history objects, see "Using the Document Info object" on page 46. ...
Scripting Guide
Page 14
... The Count Item object provides scripting support for the Color Sampler Tool. Notifier class The Notifier object ties an event to the Photoshop user interface. Preferences class The Preferences class allows you name, open the application, you could tie a script that allows you ... marquee or lasso tools and drag your document. Object name Description To create this object without using a script Application The Photoshop application. Measurement Scale class The Measurement Scale object provides scripting support for your mouse. Color Sampler class The Color Sampler object...
... The Count Item object provides scripting support for the Color Sampler Tool. Notifier class The Notifier object ties an event to the Photoshop user interface. Preferences class The Preferences class allows you name, open the application, you could tie a script that allows you ... marquee or lasso tools and drag your document. Object name Description To create this object without using a script Application The Photoshop application. Measurement Scale class The Measurement Scale object provides scripting support for your mouse. Color Sampler class The Color Sampler object...
Scripting Guide
Page 15
... Choose the path selection or pen tools and draw a path with the mouse. Choose Edit > Preferences in Windows, or Photoshop > Preferences in the document. Measurement Represents the measurement scale for your document. without using Analysis > Measurement Scale > Custom. Layer...button, the notifier object tells the script what to keep backward compatibility. Preferences The application preference settings. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 15 Object name Description To create this object without affecting other elements in the image. Choose Layer >...
... Choose the path selection or pen tools and draw a path with the mouse. Choose Edit > Preferences in Windows, or Photoshop > Preferences in the document. Measurement Represents the measurement scale for your document. without using Analysis > Measurement Scale > Custom. Layer...button, the notifier object tells the script what to keep backward compatibility. Preferences The application preference settings. CHAPTER 2: Photoshop Scripting Basics Photoshop Object Model 15 Object name Description To create this object without affecting other elements in the image. Choose Layer >...
Scripting Guide
Page 16
...to provide information (as an argument to Scripting. For example, look up the art ArtLayer object in either the Adobe Photoshop CS4 JavaScript Scripting Reference or in the containment hierarchy above. e.g., the BMP save options (BMPSaveOptions/BMPSaveOptions) class can .... One of the properties of the Application object. 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. For example: ➤ The color ...
...to provide information (as an argument to Scripting. For example, look up the art ArtLayer object in either the Adobe Photoshop CS4 JavaScript Scripting Reference or in the containment hierarchy above. e.g., the BMP save options (BMPSaveOptions/BMPSaveOptions) class can .... One of the properties of the Application object. 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. For example: ➤ The color ...
Scripting Guide
Page 17
...will be 4 inches wide and 2 inches high. 3. Our Hello World scripts will use comments to the document as a text item. 5. Open the Photoshop application. 2. Create an Art Layer object. These steps mirror a specific path in each of artLayerRef. 4. Application Document Art Layer Text Item Traditionally, the...fact, because this is the display of the text item to the Art Layer object as the value of the three scripting languages for Photoshop. When we create the document, we will create a variable named artLayerRef and then assign a reference to "Hello World". In our ...
...will be 4 inches wide and 2 inches high. 3. Our Hello World scripts will use comments to the document as a text item. 5. Open the Photoshop application. 2. Create an Art Layer object. These steps mirror a specific path in each of artLayerRef. 4. Application Document Art Layer Text Item Traditionally, the...fact, because this is the display of the text item to the Art Layer object as the value of the three scripting languages for Photoshop. When we create the document, we will create a variable named artLayerRef and then assign a reference to "Hello World". In our ...
Scripting Guide
Page 18
...change its contents. Create a new document and art layer. set its contents. --target Photoshop CS4 tell application "Adobe Photoshop CS4" -- Change the art layer to Scripting, which has a section on AppleScript debugging. Photoshop creates a new document, adds a new layer, changes the layer's type to text and... refer to Introduction to be a text layer. set contents of text object of artLayerRef to complete this procedure. CHAPTER 2: Photoshop Scripting Basics Creating a sample Hello World script 18 Creating and running an AppleScript You must open the Apple® Script Editor...
...change its contents. Create a new document and art layer. set its contents. --target Photoshop CS4 tell application "Adobe Photoshop CS4" -- Change the art layer to Scripting, which has a section on AppleScript debugging. Photoshop creates a new document, adds a new layer, changes the layer's type to text and... refer to Introduction to be a text layer. set contents of text object of artLayerRef to complete this procedure. CHAPTER 2: Photoshop Scripting Basics Creating a sample Hello World script 18 Creating and running an AppleScript You must open the Apple® Script Editor...
Scripting Guide
Page 19
... create and run a JavaScript that displays the text Hello World! NOTE: Adobe has created the Extend Script scripting language to run the script. in a Photoshop document. You can use with a .vbs file name extension. 3. in a Photoshop document. Because you will be actually using Photoshop to run your JavaScripts, it to a variable. To create and run...
... create and run a JavaScript that displays the text Hello World! NOTE: Adobe has created the Extend Script scripting language to run the script. in a Photoshop document. You can use with a .vbs file name extension. 3. in a Photoshop document. Because you will be actually using Photoshop to run your JavaScripts, it to a variable. To create and run...
Scripting Guide
Page 20
...sample Hello World script 20 To create and run your Adobe Photoshop CS4 directory. NOTE: You must place your JavaScripts in the Presets/Scripts folder in order to the Presets > Scripts folder and choose your script. ➣ Start or restart Photoshop, and then choose File > Scripts, and then ..., choose File > Scripts > Browse, and then navigate to make the scripts accessible from the Scripts menu. Type the following : ➣ If Photoshop is optional. // Hello Word Script // Remember current unit settings and then set units to // the value expected by this script var originalUnit =...
...sample Hello World script 20 To create and run your Adobe Photoshop CS4 directory. NOTE: You must place your JavaScripts in the Presets/Scripts folder in order to the Presets > Scripts folder and choose your script. ➣ Start or restart Photoshop, and then choose File > Scripts, and then ..., choose File > Scripts > Browse, and then navigate to make the scripts accessible from the Scripts menu. Type the following : ➣ If Photoshop is optional. // Hello Word Script // Remember current unit settings and then set units to // the value expected by this script var originalUnit =...
Scripting Guide
Page 21
... Open. The dictionary also lists the parameters for more information. 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 quickly understand how to script Photoshop. NOTE: The default location for the Script Editor is found in the reference manuals provided...
... Open. The dictionary also lists the parameters for more information. 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 quickly understand how to script Photoshop. NOTE: The default location for the Script Editor is found in the reference manuals provided...
Scripting Guide
Page 22
... Custom Component Set. 4. NOTE: In JavaScript, you run your script should do not need to the Photoshop objects icon. 9. Choose Photoshop CS4 type library from outside the Photoshop application, the first thing your AppleScript and VBScript scripts from the list of open and save formats. Start... Visual Studio 2005, or Visual Basic. 2. Select it. 5. On the COM tab, find "Adobe Photoshop CS4 Object Library". To view the VBS object library in Photoshop. Click on page 19.) Targeting and Referencing the Application Object Because you do is loaded into the object browser...
... Custom Component Set. 4. NOTE: In JavaScript, you run your script should do not need to the Photoshop objects icon. 9. Choose Photoshop CS4 type library from outside the Photoshop application, the first thing your AppleScript and VBScript scripts from the list of open and save formats. Start... Visual Studio 2005, or Visual Basic. 2. Select it. 5. On the COM tab, find "Adobe Photoshop CS4 Object Library". To view the VBS object library in Photoshop. Click on page 19.) Targeting and Referencing the Application Object Because you do is loaded into the object browser...
Scripting Guide
Page 23
...see in the "Photoshop Object Model" on... and collections. This section demonstrates how to accomplish these same tasks in the Photoshop application, you select File > New. For example, you add an art...then use the following to target the application: Dim appRef Set appRef = CreateObject("Photoshop.Application") JS In JavaScript, because you do not reference the Application object. ... information on the appropriate palette. CHAPTER 3: Scripting Photoshop Creating New Objects in a Script 23 AS To target Photoshop in AppleScript, you must reference the Document object ...
...see in the "Photoshop Object Model" on... and collections. This section demonstrates how to accomplish these same tasks in the Photoshop application, you select File > New. For example, you add an art...then use the following to target the application: Dim appRef Set appRef = CreateObject("Photoshop.Application") JS In JavaScript, because you do not reference the Application object. ... information on the appropriate palette. CHAPTER 3: Scripting Photoshop Creating New Objects in a Script 23 AS To target Photoshop in AppleScript, you must reference the Document object ...