Adobe 23102480 Scripting Guide - Page 81

what class to use, the class ID for the event.

Page 81 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 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")

  • 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
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")