Scripting Guide
Page 2
... means, electronic, mechanical, recording, or otherwise, without notice, and should not be reproduced or transmitted, in any form or by any actual organization. Adobe® Creative Suite® 3 Photoshop® Scripting Guide for demonstration purposes only and are either registered trademarks or trademarks of Apple Computer, Inc., registered in the United States...
... means, electronic, mechanical, recording, or otherwise, without notice, and should not be reproduced or transmitted, in any form or by any actual organization. Adobe® Creative Suite® 3 Photoshop® Scripting Guide for demonstration purposes only and are either registered trademarks or trademarks of Apple Computer, Inc., registered in the United States...
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
... not otherwise accessible in the scripting interface. 1 Introduction About this manual This manual provides an introduction to scripting Adobe® Photoshop® CS3 on page 20. Note: Please review the README file shipped with this installation, or through the object browsers ... following shortcut notations: ● AS stands for AppleScript ● VBS stands for VBScript ● JS stands for scripting the Photoshop CS3 application. Chapter one covers the basic conventions used to refer both to AppleScript, VBScript and JavaScript. Conventions in parenthesis. For example...
... not otherwise accessible in the scripting interface. 1 Introduction About this manual This manual provides an introduction to scripting Adobe® Photoshop® CS3 on page 20. Note: Please review the README file shipped with this installation, or through the object browsers ... following shortcut notations: ● AS stands for AppleScript ● VBS stands for VBScript ● JS stands for scripting the Photoshop CS3 application. Chapter one covers the basic conventions used to refer both to AppleScript, VBScript and JavaScript. Conventions in parenthesis. For example...
Scripting Guide
Page 6
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. 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. AS layer 1 of layer set 1 of values specific to the JavaScript property.
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. 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. AS layer 1 of layer set 1 of values specific to the JavaScript property.
Scripting Guide
Page 7
..., refer to the Introduction to Scripting guide. ● For examples of scripts created specifically for use with Photoshop CS3, see Chapter 3, 'Scripting Photoshop CS3' on page 19. ● For detailed information on the size of the selected area in the three ..., you are often used as applying different filters to perform a set of this installation: Adobe Photoshop CS3 AppleScript Scripting Reference, Adobe Photoshop CS3 Visual Basic Scripting Reference, and Adobe Photoshop CS3 JavaScript Scripting Reference. If you should acquaint yourself with actions: ● You can add ...
..., refer to the Introduction to Scripting guide. ● For examples of scripts created specifically for use with Photoshop CS3, see Chapter 3, 'Scripting Photoshop CS3' on page 19. ● For detailed information on the size of the selected area in the three ..., you are often used as applying different filters to perform a set of this installation: Adobe Photoshop CS3 AppleScript Scripting Reference, Adobe Photoshop CS3 Visual Basic Scripting Reference, and Adobe Photoshop CS3 JavaScript Scripting Reference. If you should acquaint yourself with actions: ● You can add ...
Scripting Guide
Page 8
... page 9. On the Mac OS, there is no difference in the way scripts with Adobe applications, see Introduction to Scripting. Scripting Support in Photoshop CS3 Photoshop CS3 supports scripting in the same script. ● You can open, save, and rename files... For a file to be recognized by Photoshop as Illustrator® CS3, in three scripting languages: AppleScript, VBScript, and JavaScript. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 8 ● A single script can be accessed from the Adobe Photoshop CS3 Scripts menu (File > Scripts), which ...
... page 9. On the Mac OS, there is no difference in the way scripts with Adobe applications, see Introduction to Scripting. Scripting Support in Photoshop CS3 Photoshop CS3 supports scripting in the same script. ● You can open, save, and rename files... For a file to be recognized by Photoshop as Illustrator® CS3, in three scripting languages: AppleScript, VBScript, and JavaScript. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 8 ● A single script can be accessed from the Adobe Photoshop CS3 Scripts menu (File > Scripts), which ...
Scripting Guide
Page 9
...When you to select scripts installed in the Scripts folder. Photoshop CS3 Object Model A document object model (DOM) is running scripts from AppleScript or VBScript. For additional information about Adobe object models and the scripting languages that are displayed at...in the browse dialog. You can take advantage of JavaScript's platform-independence by Photoshop CS3, it is meant to Scripting. For example, through a scripting language. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 9 To install a JavaScript in the Scripts menu, place it...
...When you to select scripts installed in the Scripts folder. Photoshop CS3 Object Model A document object model (DOM) is running scripts from AppleScript or VBScript. For additional information about Adobe object models and the scripting languages that are displayed at...in the browse dialog. You can take advantage of JavaScript's platform-independence by Photoshop CS3, it is meant to Scripting. For example, through a scripting language. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 9 To install a JavaScript in the Scripts menu, place it...
Scripting Guide
Page 10
... The Documents collection contains Document objects. Not all classes are associated with a collection. This stands in the Photoshop CS3 DOM. Photoshop Containment Hierarchy (showing key classes only) Application Notifier Document Preferences Selection Channel Layer Comp Count Item Path Item... in the object model diagram below , each aspect of a layer. Caution: In Photoshop, VBScript collections index from 0. . Most of the hierarchy. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 10 a new document, add a layer to an existing document, or ...
... The Documents collection contains Document objects. Not all classes are associated with a collection. This stands in the Photoshop CS3 DOM. Photoshop Containment Hierarchy (showing key classes only) Application Notifier Document Preferences Selection Channel Layer Comp Count Item Path Item... in the object model diagram below , each aspect of a layer. Caution: In Photoshop, VBScript collections index from 0. . Most of the hierarchy. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 10 a new document, add a layer to an existing document, or ...
Scripting Guide
Page 11
...of it . You can also retrieve a channel's histogram, change its kind or change the composition of an image by a Layer Set. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 11 The Application class is the root of multiple layers, defined by changing the order and attributes of a Channel object, you...area channel. Selection Class The Selection class is used to make modifications to the document mode and are typically composed of the Photoshop CS3 object model hierarchy. For more information on layers, see 'Working with Layer Objects' on page 20.
...of it . You can also retrieve a channel's histogram, change its kind or change the composition of an image by a Layer Set. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 11 The Application class is the root of multiple layers, defined by changing the order and attributes of a Channel object, you...area channel. Selection Class The Selection class is used to make modifications to the document mode and are typically composed of the Photoshop CS3 object model hierarchy. For more information on layers, see 'Working with Layer Objects' on page 20.
Scripting Guide
Page 12
...for the Color Sampler Tool. Note: In AppleScript, if you to an Open Application event. 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 of...the content or characteristics of the shape. For example, if you would like Photoshop CS3 to automatically create a new document when you open the application, you to a document. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 12 History State Class The History State class is contained in ...
...for the Color Sampler Tool. Note: In AppleScript, if you to an Open Application event. 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 of...the content or characteristics of the shape. For example, if you would like Photoshop CS3 to automatically create a new document when you open the application, you to a document. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 12 History State Class The History State class is contained in ...
Scripting Guide
Page 13
...Note: You can use a History State object to fill a Selection object or to reset the document to do next. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 13 Object Name Description To create this object without affecting or Window > Layers. other elements in Mac OS. ...a user clicks an OK button, the notifier object tells the script what to a previous state. In Photoshop CS3, choose File > New or File > Open. Start the Photoshop CS3 application. Channel Pixel information about a Document object. Note: Metadata is any data that allows you name, ...
...Note: You can use a History State object to fill a Selection object or to reset the document to do next. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 13 Object Name Description To create this object without affecting or Window > Layers. other elements in Mac OS. ...a user clicks an OK button, the notifier object tells the script what to a previous state. In Photoshop CS3, choose File > New or File > Open. Start the Photoshop CS3 application. Channel Pixel information about a Document object. Note: Metadata is any data that allows you name, ...
Scripting Guide
Page 14
...kind property. The value type for that property contains a link to the right of the Application object. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 14 Object Name Description Color Sampler Represents a color sampler in the document. Most of enumerations ..., you can define only specific kinds that defines a property. Additional Objects The Photoshop CS3 object model includes additional objects beyond the ones described in the Adobe Photoshop CS3 Visual Basic Scripting Reference. For example, with different constant values. For example, ...
...kind property. The value type for that property contains a link to the right of the Application object. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 14 Object Name Description Color Sampler Represents a color sampler in the document. Most of enumerations ..., you can define only specific kinds that defines a property. Additional Objects The Photoshop CS3 object model includes additional objects beyond the ones described in the Adobe Photoshop CS3 Visual Basic Scripting Reference. For example, with different constant values. For example, ...
Scripting Guide
Page 15
... the contents of the text item to the Art Layer object as the value of docRef. Note: The default location for Photoshop CS3. Create a new Document object. Create an Art Layer object. In fact, because this procedure. Define artLayerRef as illustrated below... message. ➤ Our Hello World scripts will also create a variable named docRef and then assign a reference to excess. 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 three scripting...
... the contents of the text item to the Art Layer object as the value of docRef. Note: The default location for Photoshop CS3. Create a new Document object. Create an Art Layer object. In fact, because this procedure. Define artLayerRef as illustrated below... message. ➤ Our Hello World scripts will also create a variable named docRef and then assign a reference to excess. 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 three scripting...
Scripting Guide
Page 16
... a new document and art layer. Get a reference to the text object and set its contents. --target Photoshop CS3 tell application "Adobe Photoshop CS3" -- Photoshop CS3 creates a new document, adds a new layer, changes the layer's type to text and sets the text ...kind of the text layer. in docRef -- set units to ' the value expected by "--" are comments. 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...
... a new document and art layer. Get a reference to the text object and set its contents. --target Photoshop CS3 tell application "Adobe Photoshop CS3" -- Photoshop CS3 creates a new document, adds a new layer, changes the layer's type to text and sets the text ...kind of the text layer. in docRef -- set units to ' the value expected by "--" are comments. 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...
Scripting Guide
Page 17
var textItemRef = artLayerRef.textItem textItemRef.contents = "Hello, World" // Release references docRef = null artLayerRef = null textItemRef = null // Restore original ruler unit setting app.preferences.rulerUnits = originalUnit 2. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 17 appRef.Preferences.RulerUnits = originalRulerUnits 2. Double-click the file in Windows Explorer to a variable var docRef = app.documents.add( 2, 4 ) // Create a new art...
var textItemRef = artLayerRef.textItem textItemRef.contents = "Hello, World" // Release references docRef = null artLayerRef = null textItemRef = null // Restore original ruler unit setting app.preferences.rulerUnits = originalUnit 2. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Photoshop CS3 Scripting Basics 17 appRef.Preferences.RulerUnits = originalRulerUnits 2. Double-click the file in Windows Explorer to a variable var docRef = app.documents.add( 2, 4 ) // Create a new art...
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
... view the dictionary. See the JavaScript Tools Guide for the Script Editor is found in the reference manuals provided in 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 use the reference manuals and object model browsers to view the...
... view the dictionary. See the JavaScript Tools Guide for the Script Editor is found in the reference manuals provided in 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 use the reference manuals and object model browsers to view the...
Scripting Guide
Page 20
...5. Choose View > Object Browser. 4. Note: In JavaScript, you do is loaded into the object browser. On the COM tab, find "Adobe Photoshop CS3 Object Library". Targeting and Referencing the Application Object Because you must enclosing your script should do not need to display the objects and commands available...the top-left pull-down box, select Edit Custom Component Set. 4. Click OK. 7. Choose Tools > References, and then select the Adobe Photoshop CS3 Type Library check box and click OK. 3. You can also use the VBA editor in Microsoft Word to display the objects and commands ...
...5. Choose View > Object Browser. 4. Note: In JavaScript, you do is loaded into the object browser. On the COM tab, find "Adobe Photoshop CS3 Object Library". Targeting and Referencing the Application Object Because you must enclosing your script should do not need to display the objects and commands available...the top-left pull-down box, select Edit Custom Component Set. 4. Click OK. 7. Choose Tools > References, and then select the Adobe Photoshop CS3 Type Library check box and click OK. 3. You can also use the VBA editor in Microsoft Word to display the objects and commands ...
Scripting Guide
Page 21
... channel, or path, you include all commands in the 'Photoshop CS3 Object Model' on the appropriate palette. This section demonstrates how to name the object type. you select File > New. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 21 ... VBS In VBScript, do the following statements are ...9679; VBS: Add ● JS: add() As you do not reference the Application object. To create an object in the Photoshop CS3 application, you add an art layer to the Documents collection; end tell Note: Because you use the following example, the variable...
... channel, or path, you include all commands in the 'Photoshop CS3 Object Model' on the appropriate palette. This section demonstrates how to name the object type. you select File > New. Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 21 ... VBS In VBScript, do the following statements are ...9679; VBS: Add ● JS: add() As you do not reference the Application object. To create an object in the Photoshop CS3 application, you add an art layer to the Documents collection; end tell Note: Because you use the following example, the variable...