Adobe 23101335 Scripting Guide - Page 33
Scripting Photoshop, 3.1 Photoshop scripting guidelines
UPC - 718659152833
View all Adobe 23101335 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 33 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. It is important to think of the objects in Photoshop as part of an "object containment hierarchy". The diagram below, read from left to right, illustrates Photoshop's containment hierarchy. The following guidelines will also 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.4, "Object references" on page 42 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 7.0" set color profile kind of document "MyDocument" to none end tell Photoshop 7.0 Scripting Guide 33