C
HAPTER
4: Action Manager
Using ScriptListener to find event IDs and class IDs
82
// =======================================================
var id17 = charIDToTypeID( "Mk " );
var desc6 = new ActionDescriptor();
var id18 = charIDToTypeID( "Nw " );
var desc7 = new ActionDescriptor();
var id19 = charIDToTypeID( "Md " );
var id20 = charIDToTypeID( "RGBM" );
desc7.putClass( id19, id20 );
var id21 = charIDToTypeID( "Wdth" );
var id22 = charIDToTypeID( "#Rlt" );
desc7.putUnitDouble( id21, id22, 800.000000 );
var id23 = charIDToTypeID( "Hght" );
var id24 = charIDToTypeID( "#Rlt" );
desc7.putUnitDouble( id23, id24, 800.000000 );
var id25 = charIDToTypeID( "Rslt" );
var id26 = charIDToTypeID( "#Rsl" );
desc7.putUnitDouble( id25, id26, 72.000000 );
var id27 = stringIDToTypeID( "pixelScaleFactor" );
desc7.putDouble( id27, 1.000000 );
var id28 = charIDToTypeID( "Fl " );
var id29 = charIDToTypeID( "Fl " );
var id30 = charIDToTypeID( "Wht " );
desc7.putEnumerated( id28, id29, id30 );
var id31 = charIDToTypeID( "Dpth" );
desc7.putInteger( id31, 8 );
var id32 = stringIDToTypeID( "profile" );
desc7.putString( id32, "sRGB IEC61966-2.1" );
var id33 = charIDToTypeID( "Dcmn" );
desc6.putObject( id18, id33, desc7 );
executeAction( id17, desc6, DialogModes.NO );
// =======================================================
var id34 = charIDToTypeID( "Mk " );
var desc8 = new ActionDescriptor();
var id35 = charIDToTypeID( "Nw " );
var desc9 = new ActionDescriptor();
var id36 = charIDToTypeID( "ClrI" );
var id37 = charIDToTypeID( "MskI" );
var id38 = charIDToTypeID( "MskA" );
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.