Skip to main content
Inspiring
Feb 22, 2017 1:29 PM UTC
Answered

Execute JavaScript via Applescript

Hi

There is a way to execute JavaScript via Applescript in InDesign using do script

tell application "Adobe InDesign CC 2014" 

    activate 

    do script "Macintosh HD:Applications:MAMP:htdocs:extendscript-library.org:tests:test:fixtures:helper:log:test_log.jsx" language javascript 

end tell

Since command do script doesn't work for Illustrator, Is there a way to tell via AppleScript to:

1. Execute Script from custom location (⌘cmd + F12)

2. Pick the script to be executed by name

Perhaps there is other work around to do this? Any support via OS X JavaScript?

This topic is closed to new replies. Start a new post to keep the conversation going.
greenrookieCorrect answer
Inspiring
Feb 23, 2017 4:41 AM UTC

Try this, HTH.

tell application "Adobe Illustrator" to open file "Macintosh HD:Applications:MAMP:htdocs:extendscript-library.org:tests:test:fixtures:helper:log:test_log.jsx"

6 replies

Loic.Aigon
Legend
Feb 23, 2017 10:09 AM UTC

Nice. I wasn't aware of that. It looks like Illustrator only as nor InDesign, nor Photoshop accept that piece of code (given of course that the target application has been changed).

Translate
Inspiring
Feb 23, 2017 12:12 PM UTC

It worked up to Photoshop CS5, but I guess things have changed.

(I'm a CS6 user)

Translate
greenrookieCorrect answer
Inspiring
Feb 23, 2017 4:41 AM UTC

Try this, HTH.

tell application "Adobe Illustrator" to open file "Macintosh HD:Applications:MAMP:htdocs:extendscript-library.org:tests:test:fixtures:helper:log:test_log.jsx"

Translate
Silly-V
Legend
Feb 22, 2017 2:38 PM UTC

You should be able to use do javascript to do it, I believe.

Translate
Pete StanAuthor
Inspiring
Feb 22, 2017 2:44 PM UTC

I forgot to mention, that I'd like to keep the repository of JavaScripts in a custom folder (not Illustrator script folder).

Translate
Loic.Aigon
Legend
Feb 22, 2017 4:06 PM UTC

do script is InDesign only. Not to confuse with do javascript which is available for AI & PS:

do javascript v : execute a javascript

do javascript any : javascript code or file to execute

[with arguments list of any] : arguments to pass to the JavaScript routine

[show debugger before running/‌never/‌on runtime error] : when should a debugger be shown? ( default: never )

→ text : execute a javascript

HTH

Loic

Translate