Using Scriptlistener To Find Event Ids And Class Ids - Adobe 65048332 Manual

Scripting guide
Table of Contents

Advertisement

C
4: Action Manager
HAPTER

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. These event and class IDs are used to set up notification using the
You can determine the event ID for any recordable action by using ScriptListener. Simply install the
ScriptListener plug in, as described in
want to find the event ID for. The event is logged in the Script Listener log file. (See
Plug-In" on page
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, 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 CS5\\
Samples\\Fish.psd" ) );
executeAction( id14, desc5, DialogModes.NO );
4. The
executeAction
action to take. The first argument, in this case
the variable
action is
5. You can now use this event ID to set up event notification on Open Document from your scripts. In
JavaScript, for example:
var eventFile = new File(app.path +
app.notifiers.add( "Opn ", eventFile)
Finding the event ID and class ID for the "New" event
1. Make sure that the ScriptListener plug in is installed.
2. Open Photoshop, then create a new document using File > New.
3. Next, create a new channel, using the Create New Channel icon on the Channels palette.
4. Find the ScriptListener log file and open it. You can use either the VBScript log file or the JavaScript log
file. We have recorded two actions, so we are interested in looking at the last two sections in the file
that are delimited by the rows of equal signs. In the JavaScript log file, you will see code that looks
something like this:
73) If the event applies to several different classes of objects, the class ID is also logged in
method runs the action from a script, and it needs the event ID to identify which
defined several lines earlier, and it shows that the event ID for the Open Document
id14
"Opn ".
"/Presets/Scripts/Event Scripts Only/Welcome.jsx")
Using ScriptListener to find event IDs and class IDs 81
"Installing ScriptListener" on page
, provides the event ID to the method. You can see
id14
Notifier
class.
73. Then execute the action you
"The ScriptListener

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

65048599Photoshop cs5

Table of Contents