I wrote a simple script which should sequentially execute individual scripts with different applications utilizing BridgeTalk.
The script is working fine if I load it in the ExtendScript Toolkit and press <F5> to execute the script in debug mode.
But if I directly execute the script by double-clicking the file, only the first script (IllustratorTasks) is executed and Photoshop is never started.
It seems the scripts hangs in the while loop and the script does never stop. I have to manually kill the "ExtendScript Toolkit" task with the windows task manager to stop the task.
Here is the script:
#target estoolkit
runScript("illustrator", "~/Desktop/IllustratorTasks.jsx");
runScript("photoshop", "~/Desktop/PhotoshopTasks.jsx");
// Run the script and wait until it has finished
function runScript(target, script)
{
$.writeln("start "+script+" in "+target);
var bt = new BridgeTalk();
var finished = false;
bt.target = target;
bt.body = "$.evalFile('"+script+"');"
bt.onResult = function(res) {
$.writeln("\nfinished:\n"+res.body);
finished = true;
}
bt.onError = function(res) {
$.writeln("\nfinished with error:\n"+res.body);
finished = true;
}
bt.send();
while (!finished)
{
$.sleep(1000);
}
}
Any idea what causes this strange behaviour and how to fix it?
Thanks!
Windows 7 64 Bit / Adobe Premium CS5.5