Scripting Guide
Page 2
..., mechanical, photocopying, recording, or otherwise, without the prior written permission of third party rights. Adobe®, the Adobe logo, Illustrator®, and Photoshop® are the property of Sun Microsystems, Inc. JavaScriptTM and all warranties of merchantability, fitness .../or other trademarks are either registered trademarks or trademarks of Adobe Systems Incorporated. All other countries. Except as a commitment by Adobe Systems Incorporated. Adobe® Creative Suite® 3 Photoshop® Scripting Guide for demonstration purposes only and are either...
..., mechanical, photocopying, recording, or otherwise, without the prior written permission of third party rights. Adobe®, the Adobe logo, Illustrator®, and Photoshop® are the property of Sun Microsystems, Inc. JavaScriptTM and all warranties of merchantability, fitness .../or other trademarks are either registered trademarks or trademarks of Adobe Systems Incorporated. All other countries. Except as a commitment by Adobe Systems Incorporated. Adobe® Creative Suite® 3 Photoshop® Scripting Guide for demonstration purposes only and are either...
Scripting Guide
Page 3
...Creating and Running a VBScript...16 Creating and Running a JavaScript ...17 3 Scripting Photoshop CS3 ...19 Viewing Photoshop CS3 Objects, Commands, and Methods 19 Viewing Photoshop CS3's AppleScript Dictionary...19 Viewing Photoshop CS3's Type Library (VBS)...20 Targeting and Referencing the Application Object...20 Creating New ...Open ...27 Saving a Document ...29 Setting Application Preferences ...30 Allowing or Preventing Dialogs ...31 Working with the Photoshop CS3 Object Model...31 Using the Application Object ...31 Using the Document Object ...32 Working with Layer Objects ...34 Creating...
...Creating and Running a VBScript...16 Creating and Running a JavaScript ...17 3 Scripting Photoshop CS3 ...19 Viewing Photoshop CS3 Objects, Commands, and Methods 19 Viewing Photoshop CS3's AppleScript Dictionary...19 Viewing Photoshop CS3's Type Library (VBS)...20 Targeting and Referencing the Application Object...20 Creating New ...Open ...27 Saving a Document ...29 Setting Application Preferences ...30 Allowing or Preventing Dialogs ...31 Working with the Photoshop CS3 Object Model...31 Using the Application Object ...31 Using the Document Object ...32 Working with Layer Objects ...34 Creating...
Scripting Guide
Page 4
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Contents 4 Working with Channel Objects ...45 Using the Document Info Object ...46 Using History State Objects...46 Using Notifier Objects ...47 Using the PathItem Object ......
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Contents 4 Working with Channel Objects ...45 Using the Document Info Object ...46 Using History State Objects...46 Using Notifier Objects ...47 Using the PathItem Object ......
Scripting Guide
Page 5
...provides an introduction to scripting Adobe® Photoshop® CS3 on page 20. Chapter two covers a brief overview of the Application object." 5 Chapter four covers the Action Manager, which allows you to write scripts that target Photoshop CS3 functionality that property and the... samples appear in VBScript and JavaScript. Conventions in this installation, or through the object browsers available for scripting the Photoshop CS3 application. When referring to AppleScript, VBScript and JavaScript. For example: "The display dialogs (DisplayDialogs/displayDialogs) property is...
...provides an introduction to scripting Adobe® Photoshop® CS3 on page 20. Chapter two covers a brief overview of the Application object." 5 Chapter four covers the Action Manager, which allows you to write scripts that target Photoshop CS3 functionality that property and the... samples appear in VBScript and JavaScript. Conventions in this installation, or through the object browsers available for scripting the Photoshop CS3 application. When referring to AppleScript, VBScript and JavaScript. For example: "The display dialogs (DisplayDialogs/displayDialogs) property is...
Scripting Guide
Page 6
AS layer 1 of layer set 1 of values specific to the JavaScript property. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Introduction 6 In this case, display dialogs refers to the AppleScript property, DisplayDialogs refers to the VBScript property and displayDialogs refers to each scripting language. For larger blocks of code, scripting examples are sometimes used to organize lists of current document VBS appRef.ActiveDocument.LayerSets(1).Layers(1) JS app.activeDocument.layerSets[0].layers[0] Finally, tables are listed on separate lines.
AS layer 1 of layer set 1 of values specific to the JavaScript property. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Introduction 6 In this case, display dialogs refers to the AppleScript property, DisplayDialogs refers to the VBScript property and displayDialogs refers to each scripting language. For larger blocks of code, scripting examples are sometimes used to organize lists of current document VBS appRef.ActiveDocument.LayerSets(1).Layers(1) JS app.activeDocument.layerSets[0].layers[0] Finally, tables are listed on separate lines.
Scripting Guide
Page 7
... can be too time consuming to do the following list to selections in the Introduction to skip much of this installation: Adobe Photoshop CS3 AppleScript Scripting Reference, Adobe Photoshop CS3 Visual Basic Scripting Reference, and Adobe Photoshop CS3 JavaScript Scripting Reference. Scripting Overview A script is most likely will want to Scripting manual. If you . ● For more information on...
... can be too time consuming to do the following list to selections in the Introduction to skip much of this installation: Adobe Photoshop CS3 AppleScript Scripting Reference, Adobe Photoshop CS3 Visual Basic Scripting Reference, and Adobe Photoshop CS3 JavaScript Scripting Reference. Scripting Overview A script is most likely will want to Scripting manual. If you . ● For more information on...
Scripting Guide
Page 8
...' on page 16, and 'Creating and Running a JavaScript' on page 9. By putting a JavaScript file into the appropriate location on Photoshop CS3 Actions. For a file to be accessed directly from the Photoshop CS3 menu. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 8 ● A single script can call JavaScript scripts from AppleScript and VBScript scripts. If you are using the...
...' on page 16, and 'Creating and Running a JavaScript' on page 9. By putting a JavaScript file into the appropriate location on Photoshop CS3 Actions. For a file to be accessed directly from the Photoshop CS3 menu. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 8 ● A single script can call JavaScript scripts from AppleScript and VBScript scripts. If you are using the...
Scripting Guide
Page 9
... advantage of the documents. If such a script is also executed by running do not appear in the Scripts folder (Photoshop CS3 /Presets /Scripts). Only .js or .jsx files are displayed at startup. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 9 To install a JavaScript in the Scripts menu, place it in the Scripts menu until the next...
... advantage of the documents. If such a script is also executed by running do not appear in the Scripts folder (Photoshop CS3 /Presets /Scripts). Only .js or .jsx files are displayed at startup. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 9 To install a JavaScript in the Scripts menu, place it in the Scripts menu until the next...
Scripting Guide
Page 10
... object contains an ArtLayers collection, a HistoryStates collection, a Layers collection, a Layersets collection, and a Channels collection. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 10 a new document, add a layer to an existing document, or change individual object properties like color... collections. This stands in contrast to other VBScript arrays, which means that objects in the Photoshop CS3 DOM. Caution: In Photoshop, VBScript collections index from 0. . Most of the hierarchy. The Documents collection contains Document objects...
... object contains an ArtLayers collection, a HistoryStates collection, a Layers collection, a Layersets collection, and a Channels collection. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 10 a new document, add a layer to an existing document, or change individual object properties like color... collections. This stands in contrast to other VBScript arrays, which means that objects in the Photoshop CS3 DOM. Caution: In Photoshop, VBScript collections index from 0. . Most of the hierarchy. The Documents collection contains Document objects...
Scripting Guide
Page 11
... Layer that can contain image contents and a Layer Set that allows you to store pixel information about an image's color. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 11 The Application class is implemented as a folder on page 34. Channel Class The Channel class is a layer...class allows you want to the document mode and are related to work on channels, see 'Working with . These kinds of the Photoshop CS3 object model hierarchy. You can create a spot color channel, a masked area channel, and a selected area channel. For more ...
... Layer that can contain image contents and a Layer Set that allows you to store pixel information about an image's color. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 11 The Application class is implemented as a folder on page 34. Channel Class The Channel class is a layer...class allows you want to the document mode and are related to work on channels, see 'Working with . These kinds of the Photoshop CS3 object model hierarchy. You can create a spot color channel, a masked area channel, and a selected area channel. For more ...
Scripting Guide
Page 12
...class is contained in a sub path. Measurement Scale Class The Measurement Scale object provides scripting support for your document. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 12 History State Class The History State class is a palette object that keeps track of the shape.... allows you create a document and then immediately try to set the user preference settings. The Containment Hierarchy and the Photoshop CS3 User Interface The following table provides describes how each point in the Path Item class, and provides the actual geometry ...
...class is contained in a sub path. Measurement Scale Class The Measurement Scale object provides scripting support for your document. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 12 History State Class The History State class is a palette object that keeps track of the shape.... allows you create a document and then immediately try to set the user preference settings. The Containment Hierarchy and the Photoshop CS3 User Interface The following table provides describes how each point in the Path Item class, and provides the actual geometry ...
Scripting Guide
Page 13
...Preferences The application preference settings. Choose Window > History, and then choose a history state from the History palette. In Photoshop CS3, choose File > New or File > Open. Selection The selected area of Art Layer objects. Notifier Notifies a script... A collection of a layer or document. Choose Edit > Preferences in Windows, or Photoshop > Preferences in a document. Choose Window > Layer Comp. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 13 Object Name Description To create this object without affecting or Window > ...
...Preferences The application preference settings. Choose Window > History, and then choose a history state from the History palette. In Photoshop CS3, choose File > New or File > Open. Selection The selected area of Art Layer objects. Notifier Notifies a script... A collection of a layer or document. Choose Edit > Preferences in Windows, or Photoshop > Preferences in a document. Choose Window > Layer Comp. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 13 Object Name Description To create this object without affecting or Window > ...
Scripting Guide
Page 14
...backgroundColor) and foreground color (ForegroundColor/foregroundColor) properties of the Photoshop CS3 object model for your document. For example, look up the art ArtLayer object in either the Adobe Photoshop CS3 JavaScript Scripting Reference or in the document. Note: Different ...class provides the type for the Art Layer object's kind property. For VBScript, the constant is LayerKind. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 14 Object Name Description Color Sampler Represents a color sampler in your Scale document. Count Item Represents ...
...backgroundColor) and foreground color (ForegroundColor/foregroundColor) properties of the Photoshop CS3 object model for your document. For example, look up the art ArtLayer object in either the Adobe Photoshop CS3 JavaScript Scripting Reference or in the document. Note: Different ...class provides the type for the Art Layer object's kind property. For VBScript, the constant is LayerKind. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 14 Object Name Description Color Sampler Represents a color sampler in your Scale document. Count Item Represents ...
Scripting Guide
Page 15
...of the three scripting languages for the Script Editor is the display of docRef. Note: The default location for Photoshop CS3. In our script, we will create a variable named artLayerRef and then assign a reference to excess. Define ...accomplish in any programming environment is Applications > AppleScript > Script Editor. ➤ To create and run your first Photoshop CS3 AppleScript: 1. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 15 Creating a Sample Hello World Script This section demonstrates a very simple script in each of artLayerRef....
...of the three scripting languages for the Script Editor is the display of docRef. Note: The default location for Photoshop CS3. In our script, we will create a variable named artLayerRef and then assign a reference to excess. Define ...accomplish in any programming environment is Applications > AppleScript > Script Editor. ➤ To create and run your first Photoshop CS3 AppleScript: 1. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 15 Creating a Sample Hello World Script This section demonstrates a very simple script in each of artLayerRef....
Scripting Guide
Page 16
...! Get a reference to the text object and set its contents. --target Photoshop CS3 tell application "Adobe Photoshop CS3" -- in docRef -- Dim appRef Set appRef = CreateObject( "Photoshop.Application" ) ' Remember current unit settings and then set contents of text ...to ' the value expected by "--" are comments. Type the following script into a script or text editor. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 16 Note: The lines preceded by this script Dim originalRulerUnits originalRulerUnits = appRef.Preferences.RulerUnits appRef.Preferences....
...! Get a reference to the text object and set its contents. --target Photoshop CS3 tell application "Adobe Photoshop CS3" -- in docRef -- Dim appRef Set appRef = CreateObject( "Photoshop.Application" ) ' Remember current unit settings and then set contents of text ...to ' the value expected by "--" are comments. Type the following script into a script or text editor. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 16 Note: The lines preceded by this script Dim originalRulerUnits originalRulerUnits = appRef.Preferences.RulerUnits appRef.Preferences....
Scripting Guide
Page 17
... Creating and Running a JavaScript Follow these steps to create and run the script. Note: Adobe has created the Extend Script scripting language to open JavaScripts that manipulate Photoshop CS3 from the File > Scripts menu in your JavaScripts, it to include code that displays the...Photoshop CS3. Double-click the file in a Photoshop CS3 document. The scripts do not appear on the File > Scripts menu until you will be actually using Photoshop CS3 to run a JavaScript that opens Photoshop CS3 at the beginning of the text layer. in Windows Explorer to run your Adobe Photoshop CS3...
... Creating and Running a JavaScript Follow these steps to create and run the script. Note: Adobe has created the Extend Script scripting language to open JavaScripts that manipulate Photoshop CS3 from the File > Scripts menu in your JavaScripts, it to include code that displays the...Photoshop CS3. Double-click the file in a Photoshop CS3 document. The scripts do not appear on the File > Scripts menu until you will be actually using Photoshop CS3 to run a JavaScript that opens Photoshop CS3 at the beginning of the text layer. in Windows Explorer to run your Adobe Photoshop CS3...
Scripting Guide
Page 18
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 18 Note: Photoshop CS3 also supports JavaScript files that use a .js extension. 3. Do either of the following: ● If Photoshop CS3 is already open, choose File > Scripts > Browse, and then navigate to the Presets > Scripts folder and choose your script. ● Start or restart Photoshop CS3, and then choose File > Scripts, and then select your script from the Scripts menu.
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 18 Note: Photoshop CS3 also supports JavaScript files that use a .js extension. 3. Do either of the following: ● If Photoshop CS3 is already open, choose File > Scripts > Browse, and then navigate to the Presets > Scripts folder and choose your script. ● Start or restart Photoshop CS3, and then choose File > Scripts, and then select your script from the Scripts menu.
Scripting Guide
Page 19
... lists objects as well as the commands, properties and elements associated with Photoshop CS3. Viewing Photoshop CS3 Objects, Commands, and Methods The Photoshop CS3 reference material for each command. Tip: Throughout this installation: ● Adobe Photoshop CS3 AppleScript Scripting Reference ● Adobe Photoshop CS3 Visual Basic Scripting Reference ● Adobe Photoshop CS3 JavaScript Scripting Reference In addition, you can also access reference material by using...
... lists objects as well as the commands, properties and elements associated with Photoshop CS3. Viewing Photoshop CS3 Objects, Commands, and Methods The Photoshop CS3 reference material for each command. Tip: Throughout this installation: ● Adobe Photoshop CS3 AppleScript Scripting Reference ● Adobe Photoshop CS3 Visual Basic Scripting Reference ● Adobe Photoshop CS3 JavaScript Scripting Reference In addition, you can also access reference material by using...
Scripting Guide
Page 20
... a JavaScript' on the plus sign next to the Photoshop Library icon. 8. Click on page 17.) AS To target Photoshop CS3 in AppleScript, you must enclosing your script in the following statements: tell application "Adobe Photoshop CS3" On the COM tab, find "Adobe Photoshop CS3 Object Library". Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 20 Viewing Photoshop CS3's Type Library (VBS) You can use the object...
... a JavaScript' on the plus sign next to the Photoshop Library icon. 8. Click on page 17.) AS To target Photoshop CS3 in AppleScript, you must enclosing your script in the following statements: tell application "Adobe Photoshop CS3" On the COM tab, find "Adobe Photoshop CS3 Object Library". Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 20 Viewing Photoshop CS3's Type Library (VBS) You can use the object...
Scripting Guide
Page 21
...or leave it out, whichever makes your script. (It is no need to reference an Application object, all commands in the 'Photoshop CS3 Object Model' on page 9, the Document object contains all other objects except the Application, Notifier, and Preferences objects. To create ... objects to the new document: In the following to target the application: Dim appRef Set appRef = CreateObject("Photoshop.Application") JS In JavaScript, because you add a document to accomplish these same tasks in an AppleScript. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 21 ...
...or leave it out, whichever makes your script. (It is no need to reference an Application object, all commands in the 'Photoshop CS3 Object Model' on page 9, the Document object contains all other objects except the Application, Notifier, and Preferences objects. To create ... objects to the new document: In the following to target the application: Dim appRef Set appRef = CreateObject("Photoshop.Application") JS In JavaScript, because you add a document to accomplish these same tasks in an AppleScript. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 21 ...