I'm trying to open and execute a JSX script via AppleScript with do script
command as described in Adobe InDesign Scripting Guide on this page and elsewhere on the interwebs:
The
do script
method gives a script a way to execute another script. The script can be a string of valid scripting code or a file on disk.
script.scpt:
tell application "Adobe InDesign 2020"
activate
set jsx_script to "Macintosh HD:Users:xxx:project:script.jsx"
set val_1 to "Foo"
set val_2 to "Bar"
set my_values to {val_1, val_2}
do script jsx_script language javascript with arguments my_values
end tell
script.jsx:
#target "InDesign"
testFunc(arguments);
function testFunc(t) {
alert('argument one: ' + t[0] + '\r' + 'argument two: ' + t[1]);
}
But it doesn't work. I'm getting "Expected end of line, etc. but found “script”." syntax error. Does it mean do script
is no longer supported? My environment is macOS 10.15.3 and InDesign 2020 (15.0.2). Thanks for any pointers.