Adobe 23102480 Scripting Guide - Page 79
Using ScriptListener to find event IDs and class IDs
UPC - 883919080222
View all Adobe 23102480 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 79 highlights
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Action Manager 79 desc7.putInteger( id34, height ); var id35 = charIDToTypeID( "Amnt" ); desc7.putInteger( id35, amount ); executeAction( id32, desc7 ); } 2. At the end of the file emboss.jsx, add the following line of JavaScript code, which executes the emboss function with arguments passed to it from an external invocation. See Introduction to Scripting for more information about passing arguments from a AppleScript to a JavaScript. // Call emboss with values provided in the "arguments" collection emboss( arguments[0], arguments[1], arguments[2] ); 3. The following AppleScript code sample opens a document and runs the Emboss filter on it: tell application "Adobe Photoshop CS3" set theFile to alias "Application:Documents:MyFile" open theFile do javascript (file ) ¬ with arguments { 75,2,89 } end tell Using ScriptListener to find event IDs and class IDs The section demonstrates how to use ScriptListener to determine event IDs and class IDs for actions taken by Photoshop CS3. These event and class IDs are used to set up notification using the Notifier Class. You can determine the event ID for any recordable action by using ScriptListener. Simply install the ScriptListener plug in, as described in 'Installing ScriptListener' on page 72. Then execute the action you want to find the event ID for. The event is logged in the Script Listener log file. (See 'The ScriptListener Plug-In' on page 72) If the event applies to several different classes of objects, the class ID is also logged in the log file. The following examples show how to find the event ID for the "Open Document" event, and the event and class IDs for the "New" event, which applies to several different classes. ➤ Finding the event ID for the "Open Document" event 1. Make sure that the ScriptListener plug in is installed. 2. Open Photoshop CS3, then open a document. 3. Find the ScriptListener log file and open it. You can use either the VBScript log file or the JavaScript log file. In the JavaScript version of the file, you will see code that looks something like this at the end of the file, everything below the row of equal signs the log of the last action taken: var id14 = charIDToTypeID( "Opn " ); var desc5 = new ActionDescriptor(); var id15 = charIDToTypeID( "null" ); desc5.putPath( id15, new File( "C:\\Program Files\\Adobe\\Adobe Photoshop CS3\\Samples\\Fish.psd" ) ); executeAction( id14, desc5, DialogModes.NO ); 4. The executeAction method runs the action from a script, and it needs the event ID to identify which action to take. The first argument, in this case id14, provides the event ID to the method. You can see the variable id14 defined several lines earlier, and it shows that the event ID for the Open Document action is "Opn ".