I haven't used AppleScript since MacOS 9.1, but this seems encouraging: Do Script: AppleScript and ExtendScript
Thanks Bruce, one of these should do the trick.
Upon closer inspection, it seems that Do Script: AppleScript and ExtendScript talks about using an AppleScript command 'Do Script' which doesn't exist in PPro.
For future reference, here is something that seems to work:
- Make a shell script that uses the osascript command. The script result is emitted via stdOut.
- turn the shell script into an executable by changing the file extension to .command and making it executable (chmod +x 755).
- call the command from an extension panel's CEP level, using createProcess(). Note that this - contrary to what you might think after reading https://medium.com/@HallgrimurTh/the-other-api-23357c99c774 - returns an object with the process id number, not the result of the script execution.
- use window.cep.process.stdout to install a callback handler for when the process produces output.
The sample code at CEP 5 HTML Extension Cookbook for CC 2014 · Adobe-CEP/CEP-Resources Wiki · GitHub turned out to be helpful getting a handle on this.
My attempts to use SetupStdOutHandler() were fruitless.