Adobe 65048332 Scripting Guide - Page 34
Using the Application object, Using the Document object, Photoshop Object Model
View all Adobe 65048332 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 34 highlights
CHAPTER 3: Scripting Photoshop Working with the Photoshop Object Model 34 Using the Application object This section describes how and when to use the Application object in a script. It also describes how to use some properties of the Application object. You use the properties and commands of the Application object to work with Photoshop functionality and objects such as the following: ➤ Global Photoshop settings or preferences, such as unit values or color settings - See "Setting Application Preferences" on page 32. ➤ Documents - You can add or open documents and set the active document. "Opening a Document" on page 28 and "Setting the Active Object" on page 25. ➤ Actions - You can execute actions created either via scripting or using the Actions palette in the Photoshop application. See "Action Manager" on page 73. 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, 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. 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 Object Model" on page 11 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 35 for a demonstration. ➤ Get the active layer. See "Setting the active layer" on page 27. ➤ Save the current document. See "Saving a Document" on page 31. ➤ Copy and paste within the active document or between different documents. See "Understanding Clipboard Interaction" on page 54.