// file = your bat file
file.execute();
//At the end of the Python script execution, you must remove the bat-file from the command in the bat-file itself or in the Python script.
var ok = false;
try {
while (1)
{
if (!file.exists) { ok = true; break; }
set_performance("stepByStep");
}
}
catch(e) { }
set_performance("accelerated");
if (!ok) throw("Error") ;
// in C:/PATH/result_file, your Python script should write some code in js format.
// for example
// var data1 = 1.234;
// var data2 = [1.234, 2345, 5,6];
// var data3 = ["string1", 2345, false];
$.evalFile("C:/PATH/result_file");
File("C:/PATH/result_file").remove();
// Now you can use data1, data2 and data3 in your jsx script
function set_performance(mode)
{
try {
var d1 = new ActionDescriptor();
var d2 = new ActionDescriptor();
var r1 = new ActionReference();
r1.putProperty( charIDToTypeID( "Prpr" ), charIDToTypeID( "PbkO" ) );
r1.putEnumerated( charIDToTypeID( "capp" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
d1.putReference( charIDToTypeID( "null" ), r1 );
d2.putEnumerated( stringIDToTypeID( "performance" ), stringIDToTypeID( "performance" ), stringIDToTypeID( mode ) );
d1.putObject( charIDToTypeID( "T " ), charIDToTypeID( "PbkO" ), d2 );
executeAction( charIDToTypeID( "setd" ), d1, DialogModes.NO );
}
catch (e) { throw(e); }
}