Skip to main content
PrintHouse
Inspiring
March 26, 2020
Question

AppleScript 'do script' no longer works with InDesign CC 2020?

  • March 26, 2020
  • 1 reply
  • 2764 views

Dear Community,

 

I'm trying to launch Javascript/ExtendScript from AppleScript in recent InDesign using "do script" command. Is that still possible? I'm getting errors as if the command is no longer valid

 

tell application "Adobe InDesign 2020"
    activate
    set jsx_script to "Macintosh HD:Users:xxx:project:script.jsx"
    set val_1 to "Foo"
    set val_1 to "Bar"
    set my_values to {val_1, val_2}
    do script jsx_script language javascript with arguments my_values
end tell

 

This generates a syntax error at the `do script` line: "Expected end of line, etc. but found “script”."

 

Any ideas?

This topic has been closed for replies.

1 reply

rob day
Community Expert
Community Expert
March 26, 2020

You haven’t defined val_2—val_1 is set to "Foo" and "Bar". The error is being generated from something in the JS you are calling.

 

This works for me:

 

 

tell application "Adobe InDesign 2020"
	activate
	set jsx_script to "...Desktop:HelloWorld.jsx"
	set a to "Foo"
	set b to "Bar"
	set my_values to {a, b}
	do script jsx_script language javascript with arguments my_values
end tell

 

 

The HelloWorld JS:

 

var a1 = arguments[0];
var a2 = arguments[1];

alert(a1 + "  " + a2);

 

PrintHouse
Inspiring
March 26, 2020

Hi Rob,

 

Thanks. val_2 was just an omission on my part while pasting the code here. The problem I'm having is AppleScript console throws an error when I want to use "do script" command. Only when I comment it out then I can save the script. May I know the macOS version and InDesign version you're trying it on?

 

rob day
Community Expert
Community Expert
March 26, 2020

InDesign 2020 and High Sierra