Adobe 23102480 Scripting Guide - Page 80

Finding the event ID and class ID for the New event, Next, create a new channel

Page 80 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Action Manager 80 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 + "/Presets/Scripts/Event Scripts Only/Welcome.jsx") 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 CS3, 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: 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" );

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85

Photoshop CS3
Adobe Photoshop CS3
Scripting Guide
Action Manager
80
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 +
"/Presets/Scripts/Event Scripts Only/Welcome.jsx")
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 CS3, 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:
// =======================================================
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" );