Adobe 23101764 Scripting Guide - Page 35
Scripting Photoshop
UPC - 718659340025
View all Adobe 23101764 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 35 highlights
3 Scripting Photoshop 3.1 Photoshop scripting guidelines Once you are used to thinking of Photoshop as an object oriented environment, as discussed in Chapter two, you are ready to move on to writing scripts for the application. The following guidelines will help save debugging time when running Photoshop scripts. • Before running scripts make sure Photoshop's Text Tool is not selected and no dialog boxes are displayed to avoid script run-time errors. • Select documents by name rather than numeric index and set the current document in your script before working on it. Document numbers do not represent their stacking order. See 3.5, "Object references" on page 55 for more information. • In AppleScript always create your document with a name and later get that document by name. -- get the front-most document set docRef to make new document with properties ¬ { height:pixels 144, width:pixels 144, resolution:50,¬ name:"My Document"} • When working in VB or JavaScript, store the document reference to a newly-created document to reuse later. • When running AppleScripts and two documents are open with the same name, both documents will be modified when the name is referenced. For example, the following script would modify the color profile of all open documents named "MyDocument." tell application "Adobe Photoshop CS" set color profile kind of document "MyDocument" to none end tell 3.2 Viewing Photoshop objects, commands and methods This section shows how to view Photoshop's objects, commands and properties in AppleScript and Visual Basic editors. JavaScript is a cross-platform language and therefore does not include a native script editor. Photoshop CS Scripting Guide 31