Adobe 23101335 Scripting Guide - Page 87

Using the Action Manager from VBScript, objApp.DoJavaScriptFile C:\Emboss.js, Array75

Page 87 highlights

Scripting Photoshop 3 Action Manager scripting Action Manager code. The next section covers how to run VBScript based Action Manager code. To access JavaScript code from VBScript, you must use the "DoJavaScriptFile" command and provide specific settings in the "arguments" parameter. Save the following script in a file called "C:\Emboss.js" function emboss( angle, height, amount ) { var id32 = charIDToTypeID( "Embs" ); var desc7 = new ActionDescriptor(); var id33 = charIDToTypeID( "Angl" ); desc7.putInteger( id33, angle ); var id34 = charIDToTypeID( "Hght" ); desc7.putInteger( id34, height ); var id35 = charIDToTypeID( "Amnt" ); desc7.putInteger( id35, amount ); executeAction( id32, desc7 ); } // Call emboss with values provided in the "arguments" collection emboss( arguments[0], arguments[1], arguments[2] ); From VBScript you can then run the Emboss filter by saying: Set objApp = CreateObject("Photoshop.Application") objApp.DoJavaScriptFile "C:\Emboss.js", Array(75, 2, 89) 3.17.2 Using the Action Manager from VBScript Using the Action Manager from VBScript is very similar to using it from JavaScript. When you have "ScriptingListener" installed on Windows, your actions will be recorded as VBScript code in the file "C:\ScriptingListenerVB.log". If you run the Emboss filter from the UI and you have the "ScriptingListener" plug-in installed you will see code as the following text at the end of "C:\ScriptingListenerVB.log"; note the numbers may vary: REM DIM objApp SET objApp = CreateObject("Photoshop.Application") DIM id19 id19 = objApp.CharIDToTypeID( "Embs" ) DIM desc4 SET desc4 = CreateObject( "Photoshop.ActionDescriptor" ) DIM id20 id20 = objApp.CharIDToTypeID( "Angl" ) Call desc4.PutInteger( id20, 135 ) Photoshop 7.0 Scripting Guide 87

  • 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
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91

Photoshop 7.0 Scripting Guide
87
Scripting Photoshop
Action Manager scripting
3
Action Manager code. The next section covers how to run VBScript based Action Manager
code.
To access JavaScript code from VBScript, you must use the “DoJavaScriptFile” command and
provide specific settings in the “arguments” parameter.
Save the following script in a file called “C:\Emboss.js”
function emboss( angle, height, amount )
{
var id32 = charIDToTypeID( "Embs" );
var desc7 = new ActionDescriptor();
var id33 = charIDToTypeID( "Angl" );
desc7.putInteger( id33, angle );
var id34 = charIDToTypeID( "Hght" );
desc7.putInteger( id34, height );
var id35 = charIDToTypeID( "Amnt" );
desc7.putInteger( id35, amount );
executeAction( id32, desc7 );
}
// Call emboss with values provided in the "arguments" collection
emboss( arguments[0], arguments[1], arguments[2] );
From VBScript you can then run the Emboss filter by saying:
Set objApp = CreateObject("Photoshop.Application")
objApp.DoJavaScriptFile "C:\Emboss.js", Array(75, 2, 89)
3.17.2 Using the Action Manager from VBScript
Using the Action Manager from VBScript is very similar to using it from JavaScript. When
you have “ScriptingListener” installed on Windows, your actions will be recorded as VBScript
code in the file “C:\ScriptingListenerVB.log”.
If you run the Emboss filter from the UI and you have the “ScriptingListener” plug-in installed
you will see code as the following text at the end of “C:\ScriptingListenerVB.log”; note the
numbers may vary:
REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
DIM id19
id19 = objApp.CharIDToTypeID( "Embs" )
DIM desc4
SET desc4 = CreateObject( "Photoshop.ActionDescriptor" )
DIM id20
id20 = objApp.CharIDToTypeID( "Angl" )
Call desc4.PutInteger( id20, 135 )