Adobe 23101335 - Photoshop - PC Manual page 85

Scripting guide
Hide thumbs Also See for 23101335 - Photoshop - PC:
Table of Contents

Advertisement

When the ScriptingListener is installed, running the Emboss filter is recorded to a file called
"ScriptingListenerJS.log" (see above for location of this file on the various platforms).
Open the "ScriptingListenerJS.log" file. At the end of the file you will see something like the
following. Note the numbers may vary:
var id19 = charIDToTypeID( "Embs" );
var desc4 = new ActionDescriptor();
var id20 = charIDToTypeID( "Angl" );
desc4.putInteger( id20, 135 );
var id21 = charIDToTypeID( "Hght" );
desc4.putInteger( id21, 3 );
var id22 = charIDToTypeID( "Amnt" );
desc4.putInteger( id22, 100 );
executeAction( id19, desc4 );
The ScriptingListener divides every command by a line, so it is easy to find the last command.
The next step in making Emboss scriptable is to identify the values that you entered (135, 3
and 100). Copy the JavaScript code from the "ScriptingListenerJS.log" file to another file and
substitute the filter values with variable names. In the following we have wrapped the code in
a JavaScript function and replaced 135 with angle, 3 with height, and 100 with amount.
function emboss( angle, height, amount )
{
}
You now have a JavaScript function that performs the Emboss filter on the current document.
To activate the Emboss filter from JavaScript you must include the function definition shown
above and then call the function with the desired parameters. To apply Emboss with angle 75,
height 2 and amount 89, you say:
// First include the emboss function somewhere in your JavaScript
// file
function emboss( angle, height, amount )
{
Photoshop 7.0 Scripting Guide
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 );
var id32 = charIDToTypeID( "Embs" );
var desc7 = new ActionDescriptor();
var id33 = charIDToTypeID( "Angl" );
Scripting Photoshop
Action Manager scripting
3
85

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop 7.0

Table of Contents