Adobe 23102480 Scripting Guide - Page 75

Using the Action Manager from a VBS Script, To create a VBScript from the ScriptListener output

Page 75 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Action Manager 75 desc4.putInteger( id20, angle ); var id21 = charIDToTypeID( "Hght" ); desc4.putInteger( id21, height ); var id22 = charIDToTypeID( "Amnt" ); desc7.putInteger( id22, amount ); executeAction( id19, desc4 ,DialogModes.NO); } 5. To use a JavaScript to apply the Emboss filter to a document, include the emboss function in the JavaScript and call the function with the desired parameters. For example, the following example applies the Emboss filter with angle 75, height 2, and amount 89. (See 'Opening a Document' on page 26, for help in writing the code to open a document within the script.) // Open the document in the script var fileRef = new File("/c/myfile") var docRef = app.open(fileRef) //Call emboss with desired parameters emboss( 75, 2, 89 ); //finish the script //include the function in the script file 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,DialogModes.NO ); } 6. Open Photoshop CS3, to apply the emboss filter by selecting File > Scripts > Browse, and then browsing to the location of your emboss.jsx script. Select Open to run the script. Using the Action Manager from a VBS Script The section demonstrates how to use the contents of the ScriptingListenerVB.log log to create your script. Before you begin this section, you need to have already recorded an action. The example in this section assumes you have followed the instructions in 'Recording a Script using ScriptListener' on page 73. The procedures in this section use the Action Manager to make the Emboss filter available to the scripting interface. ➤ To create a VBScript from the ScriptListener output: 1. Open ScriptingListenerVB.log from the desktop. At the end of the file you will see code similar to the following (although your numbers may be different): DIM objApp SET objApp = CreateObject("Photoshop.Application") REM Use dialog mode 3 for show no dialogs DIM dialogMode dialogMode = 3

  • 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
75
desc4.putInteger( id20, angle );
var id21 = charIDToTypeID( "Hght" );
desc4.putInteger( id21, height );
var id22 = charIDToTypeID( "Amnt" );
desc7.putInteger( id22, amount );
executeAction( id19, desc4 ,DialogModes.NO);
}
5.
To use a JavaScript to apply the Emboss filter to a document, include the emboss function in the
JavaScript and call the function with the desired parameters. For example, the following example
applies the Emboss filter with angle 75, height 2, and amount 89. (See
‘Opening a Document’ on
page 26
, for help in writing the code to open a document within the script.)
// Open the document in the script
var fileRef = new File("/c/myfile")
var docRef = app.open(fileRef)
//Call emboss with desired parameters
emboss( 75, 2, 89 );
//finish the script
//include the function in the script file
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,DialogModes.NO );
}
6.
Open Photoshop CS3, to apply the emboss filter by selecting
File > Scripts > Browse
, and then
browsing to the location of your emboss.jsx script. Select
Open
to run the script.
Using the Action Manager from a VBS Script
The section demonstrates how to use the contents of the
ScriptingListenerVB.log
log to create your
script. Before you begin this section, you need to have already recorded an action. The example in this
section assumes you have followed the instructions in
‘Recording a Script using ScriptListener’ on page 73
.
The procedures in this section use the Action Manager to make the Emboss filter available to the scripting
interface.
To create a VBScript from the ScriptListener output:
1.
Open
ScriptingListenerVB.log
from the desktop.
At the end of the file you will see code similar to the following (although your numbers may be
different):
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3