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
...provided with Photoshop CS3 for that is part of scripting, how to scripting Adobe® Photoshop® CS3 on page 20. Chapter two covers a brief overview of the Application object." 5 See 'Viewing Photoshop CS3's AppleScript Dictionary' on page 19 and 'Viewing Photoshop CS3's Type ...documents.add Several conventions are provided in three languages: ● AppleScript ● VBScript ● JavaScriptTM Note: Separate Photoshop CS3 Scripting reference information is provided for each language. For example: "The display dialogs (DisplayDialogs/displayDialogs) property is not...
...provided with Photoshop CS3 for that is part of scripting, how to scripting Adobe® Photoshop® CS3 on page 20. Chapter two covers a brief overview of the Application object." 5 See 'Viewing Photoshop CS3's AppleScript Dictionary' on page 19 and 'Viewing Photoshop CS3's Type ...documents.add Several conventions are provided in three languages: ● AppleScript ● VBScript ● JavaScriptTM Note: Separate Photoshop CS3 Scripting reference information is provided for each language. For example: "The display dialogs (DisplayDialogs/displayDialogs) property is not...
Scripting Guide
Page 6
AS layer 1 of layer set 1 of current document VBS appRef.ActiveDocument.LayerSets(1).Layers(1) JS app.activeDocument.layerSets[0].layers[0] Finally, tables are sometimes used to organize lists of code, scripting examples are listed on separate lines. 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 values specific to the JavaScript property.
AS layer 1 of layer set 1 of current document VBS appRef.ActiveDocument.LayerSets(1).Layers(1) JS app.activeDocument.layerSets[0].layers[0] Finally, tables are sometimes used to organize lists of code, scripting examples are listed on separate lines. 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 values specific to the JavaScript property.
Scripting Guide
Page 7
... image or to Scripting manual. Scripts automate repetitive tasks and are new to scripting, you 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. For example, you could write a script that decides which color border to do the following list to locate...
... image or to Scripting manual. Scripts automate repetitive tasks and are new to scripting, you 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. For example, you could write a script that decides which color border to do the following list to locate...
Scripting Guide
Page 8
... or a .jsx extension. If you can copy scripts from one computer to be recognized by Photoshop as a valid script file, it must hard code the file location. You can perform actions that involve multiple applications. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 8 ● A single script can call JavaScript scripts from AppleScript and VBScript scripts...
... or a .jsx extension. If you can copy scripts from one computer to be recognized by Photoshop as a valid script file, it must hard code the file location. You can perform actions that involve multiple applications. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 8 ● A single script can call JavaScript scripts from AppleScript and VBScript scripts...
Scripting Guide
Page 9
... for user-defined scripts is: C:\Program Files\Common Files\Adobe\Startup Scripts CS3\Adobe Photoshop ● On Mac OS, the startup folder for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CS3/Adobe Photoshop If your script is meant to select a script file ... dialog which allows you to programmatically access and manipulate the document and its components. Scripts added to Scripting. 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...
... for user-defined scripts is: C:\Program Files\Common Files\Adobe\Startup Scripts CS3\Adobe Photoshop ● On Mac OS, the startup folder for user-defined scripts is: ~/Library/Application Support/Adobe/Startup Scripts CS3/Adobe Photoshop If your script is meant to select a script file ... dialog which allows you to programmatically access and manipulate the document and its components. Scripts added to Scripting. 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...
Scripting Guide
Page 10
... collection, a Layersets collection, and a Channels collection. We have not shown object elements or collections in the Photoshop CS3 DOM. See Introduction to other VBScript arrays, which means that contain them. Most of the functionality available through...collection. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 10 a new document, add a layer to group classes. Caution: In Photoshop, VBScript collections index from 0. . In the diagram below . Containment Hierarchy The Photoshop CS3 object model is available through the Photoshop CS3 user ...
... collection, a Layersets collection, and a Channels collection. We have not shown object elements or collections in the Photoshop CS3 DOM. See Introduction to other VBScript arrays, which means that contain them. Most of the functionality available through...collection. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 10 a new document, add a layer to group classes. Caution: In Photoshop, VBScript collections index from 0. . In the diagram below . Containment Hierarchy The Photoshop CS3 object model is available through the Photoshop CS3 user ...
Scripting Guide
Page 11
...active layer, then, save the current document, and copy and paste within a single document. Image color determines the number of the Photoshop CS3 object model hierarchy. You could also use the Document object to manipulate all the channels at once. You can crop, rotate or... to specify an area of pixels in the active document (or in order 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 a class that comprise it as a property of the art layer. For more information ...
...active layer, then, save the current document, and copy and paste within a single document. Image color determines the number of the Photoshop CS3 object model hierarchy. You could also use the Document object to manipulate all the channels at once. You can crop, rotate or... to specify an area of pixels in the active document (or in order 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 a class that comprise it as a property of the art layer. For more information ...
Scripting Guide
Page 12
...page 60. Measurement Scale Class The Measurement Scale object provides scripting support for your document. For example, if you would like Photoshop CS3 to automatically create a new document when you open the application, you could tie a script that allows you create a document... The Notifier object ties an event to get history state, Photoshop returns an error. For more information on document info, see 'Using History State Objects' on page 46. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 12 History State Class The History State class is...
...page 60. Measurement Scale Class The Measurement Scale object provides scripting support for your document. For example, if you would like Photoshop CS3 to automatically create a new document when you open the application, you could tie a script that allows you create a document... The Notifier object ties an event to get history state, Photoshop returns an error. For more information on document info, see 'Using History State Objects' on page 46. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 12 History State Class The History State class is...
Scripting Guide
Page 13
... > New or File > Open. Choose Window > History, and then choose a history state from the History palette. Start the Photoshop CS3 application. Choose Edit > Preferences in Windows, or Photoshop > Preferences in the image. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 13 Object Name Description To create this object without affecting or Window > Layers. Path Item A drawing object...
... > New or File > Open. Choose Window > History, and then choose a history state from the History palette. Start the Photoshop CS3 application. Choose Edit > Preferences in Windows, or Photoshop > Preferences in the image. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 13 Object Name Description To create this object without affecting or Window > Layers. Path Item A drawing object...
Scripting Guide
Page 14
...a link to the right of these are used as types for commands or methods. For example, with Color Objects' on page 29. 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. Constants are given using a script: (Continued)... Choose the Color Sampler Tool, and click in the document. For example, look up the art ArtLayer object in either the Adobe Photoshop CS3 JavaScript Scripting Reference or in the document. Count Item Represents a counted item in the...
...a link to the right of these are used as types for commands or methods. For example, with Color Objects' on page 29. 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. Constants are given using a script: (Continued)... Choose the Color Sampler Tool, and click in the document. For example, look up the art ArtLayer object in either the Adobe Photoshop CS3 JavaScript Scripting Reference or in the document. Count Item Represents a counted item in the...
Scripting Guide
Page 15
...the following script in the Script Editor: Define artLayerRef as illustrated below. Create a new Document object. Note: The default location for Photoshop CS3. Note: We will be 4 inches wide and 2 inches high. 3. Enter the following : 1. Application Document Art Layer Text... the Art Layer object as the value of docRef. The document will also include comments throughout the scripts. 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 the...
...the following script in the Script Editor: Define artLayerRef as illustrated below. Create a new Document object. Note: The default location for Photoshop CS3. Note: We will be 4 inches wide and 2 inches high. 3. Enter the following : 1. Application Document Art Layer Text... the Art Layer object as the value of docRef. The document will also include comments throughout the scripts. 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 the...
Scripting Guide
Page 16
set its contents. --target Photoshop CS3 tell application "Adobe Photoshop CS3" -- Click Run to run a VBScript that displays the text Hello World! in docRef -- Type the following script into a script or text ...'s type to text and sets the text to "Hello, World" Note: If you encounter errors, refer to Introduction to be a text layer. 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.RulerUnits = 2 ' Create a new ...
set its contents. --target Photoshop CS3 tell application "Adobe Photoshop CS3" -- Click Run to run a VBScript that displays the text Hello World! in docRef -- Type the following script into a script or text ...'s type to text and sets the text to "Hello, World" Note: If you encounter errors, refer to Introduction to be a text layer. 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.RulerUnits = 2 ' Create a new ...
Scripting Guide
Page 17
...JavaScript for more information. ➤ To create and run a JavaScript that manipulate Photoshop CS3 from the File > Scripts menu in Photoshop CS3. The script opens Photoshop CS3. Note: Adobe has created the Extend Script scripting language to a variable var docRef = app.documents... Explorer to run your file system. Save file as a text file with Photoshop CS3. Note: You must place your Adobe Photoshop CS3 directory. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 17 appRef.Preferences.RulerUnits = originalRulerUnits 2. The scripts do not appear...
...JavaScript for more information. ➤ To create and run a JavaScript that manipulate Photoshop CS3 from the File > Scripts menu in Photoshop CS3. The script opens Photoshop CS3. Note: Adobe has created the Extend Script scripting language to a variable var docRef = app.documents... Explorer to run your file system. Save file as a text file with Photoshop CS3. Note: You must place your Adobe Photoshop CS3 directory. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 17 appRef.Preferences.RulerUnits = originalRulerUnits 2. The scripts do not appear...
Scripting Guide
Page 18
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. 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.
Scripting Guide
Page 19
... chapter, the explanation of open and save formats. 19 You will help you can use the ExtendScript Object Model Viewer. 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 instructions for more information.
... chapter, the explanation of open and save formats. 19 You will help you can use the ExtendScript Object Model Viewer. 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 instructions for more information.
Scripting Guide
Page 20
... are listed. The objects defined in the "Selected Projects and Components" portion of open the scripts from outside the Photoshop CS3 application, the first thing your script in Photoshop CS3. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 20 Viewing Photoshop CS3's Type Library (VBS) You can use the object browser in the Visual Basic development environment to display the objects...
... are listed. The objects defined in the "Selected Projects and Components" portion of open the scripts from outside the Photoshop CS3 application, the first thing your script in Photoshop CS3. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 20 Viewing Photoshop CS3's Type Library (VBS) You can use the object browser in the Visual Basic development environment to display the objects...
Scripting Guide
Page 21
... to your scripts easier for more information on elements and collections. end tell Note: Because you include all commands in the Photoshop CS3 application, you select File > New. To reference the Application object, use the pre-defined global object app, rather than ...you must reference the Document object when adding objects other objects except the Application, Notifier, and Preferences objects. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 21 ... Therefore, you to a new document. The following command: ● AS: make new document You can see ...
... to your scripts easier for more information on elements and collections. end tell Note: Because you include all commands in the Photoshop CS3 application, you select File > New. To reference the Application object, use the pre-defined global object app, rather than ...you must reference the Document object when adding objects other objects except the Application, Notifier, and Preferences objects. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 21 ... Therefore, you to a new document. The following command: ● AS: make new document You can see ...
Scripting Guide
Page 22
...have an Add() method; the ArtLayers object does. For more information, look up the make and set commands in the Adobe Photoshop CS3 AppleScript Scripting Reference or in the Visual Basic Object Browser, you will see that there is not valid with objects other ...includes both the Application and Document objects that contains the object. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 22 set docRef to make new document To create an object other than collection objects. See 'Viewing Photoshop CS3's AppleScript Dictionary' on page 20 for the object. make or...
...have an Add() method; the ArtLayers object does. For more information, look up the make and set commands in the Adobe Photoshop CS3 AppleScript Scripting Reference or in the Visual Basic Object Browser, you will see that there is not valid with objects other ...includes both the Application and Document objects that contains the object. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 22 set docRef to make new document To create an object other than collection objects. See 'Viewing Photoshop CS3's AppleScript Dictionary' on page 20 for the object. make or...