Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Passing arguments from Air to Photoshop jsx script

$
0
0

I would like to invoke JavaScript file in Photoshop from my Adobe Air application. I managed to call my script with the following code:

 

// Create native startup info

nativeProcessStartupInfo = new NativeProcessStartupInfo();

nativeProcessStartupInfo.executable = filePhotoshop; // File referencing Photoshop exe

// Create Vector array to pass arguments

procarg = new Vector.<String>();

procarg.push("start");

procarg.push(jsFileToCall);// String with path to my jsx file

procarg.push(scriptData); // String with argument to pass to jsx file

nativeProcessStartupInfo.arguments = procarg;

// Create native process object for calling  executable file

process = new NativeProcess();

// SET ERROR HANDLERS

process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA ,onError,false,0,true);

process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR ,onError,false,0,true);

process.addEventListener(IOErrorEvent.STANDARD_INPUT_IO_ERROR ,onError,false,0,true);

process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR ,onError,false,0,true);

process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA ,onError,false,0,true);

// CALL NATIVE PROCESS

process.start(nativeProcessStartupInfo);

 

The Photoshop app is started, my JavaScript is invoked, but the argument is not passed into jsx.

 

Is there any method how to pass arguments to script in Photoshop? (I know that I can use the file to pass the parameters, but I do not like that solution.)

 

Thanks in advance for any hint.

 

Zdenek M


Viewing all articles
Browse latest Browse all 12244

Trending Articles