I'm calling a node script from an inDesign script via app.doScript + applescript, works like a charm. Now i'm trying to find a way to let inDesign wait for the node stuff to complete and continue with returned values:
var response = app.doScript("tell application \"Terminal\" do script with command \"node\" script.js [...]"); // wait for async js to finish... alert(response);
I'm pretty new to InDesign scripting and was thinking about something like a with-callback-version of doScript or an event, but didn't find anything.
Is it possible?
Thank you very much!
I think your solution is to use a flag system. That could be a temp file that your node js would output when it ends. Indesign script on its side would monitor this file appearance thanks to idle events. Then analyze file content and later remove it.