Illustrator Script: Pass Variable From Javascript to AppleScript
Copy link to clipboard
Copied
Could you please anyone share the codes for below points:
- Pass variable from Javascript to AppleScript in illustrator file.
- Pass the arguments from applescript to javascript in illustrator file.
Explore related tutorials & articles
Copy link to clipboard
Copied
Communicating from AS to JSX? Ask teh Google:
https://www.google.com/search?q=applescript+illustrator+%22do+javascript%22+arguments
First hit:
For JSX to AS, you are hobbled by AI’s ExtendScript API. InDesign’s JSX API has a handy:
Application.doScript(script, [language], [arguments], ...)
Illustrator’s does not. If you want to AI’s JSX to communicate with outside systems you’ll have to bodge it somehow, e.g. via Google again:
Copy link to clipboard
Copied
Thank you! @hhas01
Copy link to clipboard
Copied
There is no good way unfortunately but it can be done. Read this post from the other day to get an idea of a few options.
Option A:
- write the variable to a file
- fire a pre-built applescript with `File.execute()`
- read the variable file inside of your applescript and the let applescript do it's work
- write the variable you need from applescript to a file
- pause in JSX until applescript finishes then read that file to load the variable
Option B:
- use the clipboard trick from @CarlosCanto to copy the variable to the clipboard in JSX
- fire a pre-built applescript that reads the clipboard and does it's work
- put the applescript variable in the clipboard
- wait in JSX and paste the variable to read it and load into a JSX variable
Copy link to clipboard
Copied
Thank you! @jduncan

