0

I can use AppleScript to send ExtendScript to Photoshop and get back the result:

This sends "2" to stdout:

tell application "Adobe Photoshop CC 2017"
    do javascript "var x = 2; x"
end tell

I get a syntax error when I try the same thing for InDesign 2015:

This results in a syntax error: Expected end of line but found application constant or consideration.

tell application "Adobe InDesign CC 2015"
    do javascript "var x = 2; x"
end tell

This similar code, using script instead of javascript does slightly better, resulting in this error message: Adobe InDesign CC 2015 got an error: A identifier can’t go after this identifier.

tell application "Adobe InDesign CC 2015"
    do script "var x = 2; x"
end tell

Any suggestions for getting this to work?

Max Heiber
  • 14,346
  • 12
  • 59
  • 97
  • Does this thread help? It's for After Effects, but checkout the last reply and see if it applies to you: https://forums.adobe.com/thread/973002 – ariestav Jan 04 '17 at 00:02
  • What if you use the last method on this page (with more modern modifications) http://macscripter.net/viewtopic.php?id=15506 and just do `x = 2;`? What happens? – CRGreen Jan 04 '17 at 04:02

1 Answers1

3

The main difference is that "do script" is a specific command of the InDesign Scripting model in Applescript so its syntax is specific.

set myJavaScript to "var x = 2; x"
do script myJavaScript language javascript
Loic
  • 2,173
  • 10
  • 13