Adobe Smoke Alarm CS3 Manuale Utente
Photoshop CS3
Adobe Photoshop CS3 Scripting Guide
Action Manager 78
Running JavaScript-based Action Manager code from VBScript
You can also access JavaScript-based Action Manager code from a VBScript using the
DoJavaScriptFile
method. Use the VBscript object browser for more information on the
Application
.
DoJavaScriptFile
method.
➤
To execute JavaScript-based Action Manager code from a VBScript:
1. Follow steps 1-4 in
. You will end up with a file
(
emboss.jsx
) containing the following JavaScript code:
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 );
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 );
}
2. At the end of the file
emboss.jsx
, add the following line of JavaScript code, which executes the
emboss function with arguments passed to it from an external invocation. See Introduction to Scripting
for more information about passing arguments from a VBScript to a JavaScript.
for more information about passing arguments from a VBScript to a JavaScript.
// Call emboss with values provided in the "arguments" collection
emboss( arguments[0], arguments[1], arguments[2] );
emboss( arguments[0], arguments[1], arguments[2] );
3.
From a VBScript you can then run the Emboss filter by saying (this example assumes
emboss.jsx is
found in C:\):
Set objApp = CreateObject("Photoshop.Application")
'Open the document in the script
filename = “C:\MyFile”
DIM docRef
SET docRef = objApp.Open(filename)
filename = “C:\MyFile”
DIM docRef
SET docRef = objApp.Open(filename)
objApp.DoJavaScriptFile "C:\emboss.jsx", Array(75, 2, 89)
Running JavaScript-based Action Manager code from AppleScript
There is no Action Manager functionality in AppleScript. However, you can execute JavaScript code and
files from AppleScript using the
files from AppleScript using the
do javascript
command. For further information, please refer to
Introduction to Scripting.
1. Follow steps 1-4 in
. You will end up with a file
(
emboss.jsx
) containing the following JavaScript code:
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" );
var desc7 = new ActionDescriptor();
var id33 = charIDToTypeID( "Angl" );
desc7.putInteger( id33, angle );
var id34 = charIDToTypeID( "Hght" );