
C
HAPTER
4: Action Manager
Using the Action Manager from a VBS Script
76
4.
Wrap the code in a JavaScript function. In the following example, the function name is
emboss
.
function emboss( angle, height, amount )
{
var id19 = charIDToTypeID( "Embs" );
var desc4 = new ActionDescriptor();
var id20 = charIDToTypeID( "Angl" );
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 28
, 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, 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 74
.
The procedures in this section use the Action Manager to make the Emboss filter available to the scripting
interface.
Содержание 65048332
Страница 1: ...SCRIPTING GUIDE ADOBE PHOTOSHOP CS5...