A SERVICE OF

logo

Photoshop CS3
Adobe Photoshop CS3 Scripting Guide Action Manager 81
desc9.putEnumerated( id36, id37, id38 );
var id39 = charIDToTypeID( "Clr " );
var desc10 = new ActionDescriptor();
var id40 = charIDToTypeID( "Rd " );
desc10.putDouble( id40, 255.000000 );
var id41 = charIDToTypeID( "Grn " );
desc10.putDouble( id41, 0.000000 );
var id42 = charIDToTypeID( "Bl " );
desc10.putDouble( id42, 0.000000 );
var id43 = charIDToTypeID( "RGBC" );
desc9.putObject( id39, id43, desc10 );
var id44 = charIDToTypeID( "Opct" );
desc9.putInteger( id44, 50 );
var id45 = charIDToTypeID( "Chnl" );
desc8.putObject( id35, id45, desc9 );
executeAction( id34, desc8, DialogModes.NO );
5. The first section represents the scripting code to execute the “New Document” event. The second
section represents the scripting code for the “New Channel” event.
6. The
executeAction method for both of these actions takes an argument whose value is defined as
"Mk ". (See id17 and id34.) This is the event ID for the “New” action. This action also needs to know
what class to use, the class ID for the event.
7. The
putObject method identifies the class the action operates on. The second argument to
putObject provides us with the class ID that we need. In the first action, id33 is defined as "Dcmn", in
the second action,
id45 is defined as "Chnl". These provide our class IDs for Document and Channel,
respectively.
8. You can now use these event and class IDs to set up event notification on the New Document and New
Channel events from your scripts. In JavaScript, for example:
var eventFile = new File(app.path +
"/Presets/Scripts/Event Scripts Only/Welcome.jsx")
app.notifiers.add("Mk ", eventFile, "Dcmn")
app.notifiers.add("Mk ", eventFile, "Chnl")