Skip to main content
sstrs
Participant
July 9, 2016
Answered

[jsx] app.doScript synchronous / callback / event?

  • July 9, 2016
  • 2 replies
  • 1454 views

Dear all,

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!

cheers

This topic has been closed for replies.
Correct answer sstrs

I wrote a package for this (mac only):

GitHub - dr0wsyy/async-indesign-script: Talk to ID from node and get a callback.

2 replies

sstrs
sstrsAuthorCorrect answer
Participant
January 12, 2018
Loic.Aigon
Legend
July 9, 2016

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.