Adobe 23102480 Scripting Guide - Page 32
Using the Document Object, Manipulating a Document Object
UPC - 883919080222
View all Adobe 23102480 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 32 highlights
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 32 You use the properties and commands of the Application object to work with Photoshop CS3 functionality and objects such as the following: ● Global Photoshop CS3 settings or preferences, such as unit values or color settings. See 'Setting Application Preferences' on page 30. ● Documents-You can add or open documents and set the active document. 'Opening a Document' on page 26 and 'Setting the Active Object' on page 23. ● Actions-You can execute actions created either via scripting or using the Actions palette in the Photoshop CS3 application. See 'Action Manager' on page 72. You can use Application object properties to get information such as the following: ● A list of fonts installed on the system. ● AS: Set theFonts to fonts Note: In AppleScript, fonts is a separate collection, and does not require a reference to the application object to retrieve it. ● VBS: Set fontsInstalled = AppRef.Fonts ● JS: var fontsInstalled = app.fonts ● The amount of unused memory available to Adobe Photoshop CS3, using the free memory (FreeMemory/freeMemory) property of the Application object. ● The location of the Preferences folder, using the preferences folder (PreferencesFolder/preferencesFolder) property of the Application object. For further information, look up the properties of the Application object in the reference manual or the object browser of the language you are using. Using the Document Object The Document object can represent any open document in Photoshop CS3. You can think of a Document object as a file; you can also think of it as a canvas. You work with the Document object to do the following: ● Access script objects contained in the Document object, such as ArtLayer or Channel objects. See 'Photoshop CS3 Object Model' on page 9 for more information. ● Manipulate a specific Document object, using commands or methods. For example, you could crop, rotate or flip the canvas, resize the image or canvas, and trim the image. See 'Manipulating a Document Object' on page 32 for a demonstration. ● Get the active layer. See 'Setting the Active Layer' on page 25. ● Save the current document. See 'Saving a Document' on page 29. ● Copy and paste within the active document or between different documents. See 'Understanding Clipboard Interaction' on page 54. Manipulating a Document Object The following examples demonstrate how to do the following: ● Save the existing ruler unit preferences, and set ruler units to inches ● Open an existing file as a document (using file Ducky.tif ) ● Change the size of the image to 4 inches wide and 4 inches high. ● Change the size of the document window (or canvas) to 4 inches high and 4 inches wide. ● Trim the top and bottom of the image.