• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Explorer ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

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?

TOPICS
Scripting

Views

1.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

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);

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

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?

 

Screenshot 2020-03-26 at 16.36.11.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

InDesign 2020 and High Sierra

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

Does this compile?

 

 

tell application "Adobe InDesign 2020"
	do script "alert(\"Hi\");" language javascript
end tell

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

Sadly, no. Must be macOS Catalina, then?

 

Screenshot 2020-03-26 at 18.26.36.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

Probably. There does seem to be a lot of AS problems with Catalina. I’m seeing some apps abandon their AS support—the latest version of Fetch is no longer scriptable.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

Happy to report the above works after upgrading to macOS 10.15.4!

 

So the issue was definitely Catalina 10.15.3 – not sure about earlier.

 

Phew!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

I'm having the same issue with 10.15.7

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 16, 2020 Nov 16, 2020

Copy link to clipboard

Copied

LATEST

I am as well.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines