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

Illustrator Script: Pass Variable From Javascript to AppleScript

Explorer ,
Aug 25, 2023 Aug 25, 2023

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.
 
TOPICS
Scripting
383
Translate
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
Adobe
Engaged ,
Aug 25, 2023 Aug 25, 2023

Communicating from AS to JSX? Ask teh Google:

 

https://www.google.com/search?q=applescript+illustrator+%22do+javascript%22+arguments

 

First hit:

 

https://community.adobe.com/t5/illustrator-discussions/parameter-pass-from-applescript-to-javascript...

 

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:

 

https://community.adobe.com/t5/illustrator-discussions/use-command-line-from-illustrator-script/td-p...

Translate
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 ,
Aug 25, 2023 Aug 25, 2023
LATEST

Thank you! @hhas01 

Translate
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 ,
Aug 25, 2023 Aug 25, 2023

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:

  1. write the variable to a file
  2. fire a pre-built applescript with `File.execute()`
  3. read the variable file inside of your applescript and the let applescript do it's work
  4. write the variable you need from applescript to a file
  5. pause in JSX until applescript finishes then read that file to load the variable

 

Option B:

  1. use the clipboard trick from @CarlosCanto to copy the variable to the clipboard in JSX
  2. fire a pre-built applescript that reads the clipboard and does it's work
  3. put the applescript variable in the clipboard
  4. wait in JSX and paste the variable to read it and load into a JSX variable

 

Translate
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 ,
Aug 25, 2023 Aug 25, 2023

Thank you! @jduncan 

Translate
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