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

Illustrator crashes when call action with app.doscript

Contributor ,
Jan 26, 2023 Jan 26, 2023

Hi community, hope you're all doing great.

I need some help, whenever I execute my script from visual code (it is an UI dialog that executes app.Script) the script works great, but after copying that file to the script folder in AI and make it an action, it always crashes AI at the very specific moment I call an specific actions with app.doScript, it only works when I execute it from visual code.

 

Is there anybody who already have experimented this? Thank you

TOPICS
Bug , Scripting
1.6K
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

correct answers 1 Correct answer

Community Expert , Jan 26, 2023 Jan 26, 2023

Yeah, this gets asked about once a week on here. Basically, Ai ExtendScript is single threaded so when you initiate a script from within an action (first thread) and that script tries to run another action (second thread) Ai hangs since it's waiting for the first action to end. If you try just running the script from File > Scripts it probably works fine.

 

Now, if you are initiating the script via an action so that you can access it via a hotkey I recommend trying BetterTouchTool (Mac) or AutoHot

...
Translate
Community Expert ,
Jan 26, 2023 Jan 26, 2023

Yeah, this gets asked about once a week on here. Basically, Ai ExtendScript is single threaded so when you initiate a script from within an action (first thread) and that script tries to run another action (second thread) Ai hangs since it's waiting for the first action to end. If you try just running the script from File > Scripts it probably works fine.

 

Now, if you are initiating the script via an action so that you can access it via a hotkey I recommend trying BetterTouchTool (Mac) or AutoHotkey (Windows) to fire the script via a keyboard shortcut.

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
Contributor ,
Jan 26, 2023 Jan 26, 2023

My bad! I really did not know that this could happen once in a while, that's exactly what I am trying to do (well I did not know either that this question is often , my apologies but now I know what's happening)

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
Contributor ,
Jan 26, 2023 Jan 26, 2023

Another question, sorry, so AutoHotkey (Windows) will alow me to trigger the script just like if I run it via: File > Scripts?

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 ,
Jan 26, 2023 Jan 26, 2023

Yes, I'm on a Mac but I do know that you can fire script from your script menu using AutoHotkey. Read this to get more insight.

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
Enthusiast ,
Jan 28, 2023 Jan 28, 2023

You can also read this instruction on how to assign a script to a hotkey in AutoHotkey.

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
Contributor ,
Jan 28, 2023 Jan 28, 2023

thank you so much!

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
Contributor ,
Mar 01, 2023 Mar 01, 2023

Hi ! Been a while! I am trying to make the script work with BetterTouchTool , but once I trigger with my key combination Mac shows a message telling me to choose an app to open that file, how can you open scripts in illustration using BetterTouchTool ? Does the script need to be written in AppleScript? Thanks!

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 ,
Mar 01, 2023 Mar 01, 2023

Here's how I have it set up. "AiCommandPalette" is the name of the script it runs. The script needs to be in the Ai scripts folder too.

 

Screen Shot 2023-03-01 at 16.56.08.pngexpand image

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
Enthusiast ,
Mar 01, 2023 Mar 01, 2023

I also recommend a free Japanese utility called "SPAi" for Mac OS. I've been using it myself for more than a year, it supports various hotkeys for launching scripts.

spai.jpgexpand image

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 ,
Mar 01, 2023 Mar 01, 2023

Nice! I wasn't aware of this option. 👍

 

I probably should have mentioned earlier that I actually use Keyboard Maestro to do this on my personal machine (even though I mentioned Better Touch Tool before). Keyboard Maestro is a swiss army knife for Mac automation but it isn't cheap. Just wanted to be transparent. Cheers!

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
Contributor ,
Mar 02, 2023 Mar 02, 2023

@jduncan @Sergey Osokin thank you both friends! I will give it a try today

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
Enthusiast ,
Mar 18, 2023 Mar 18, 2023

Does the same limitation apply if you run the script that calls an action from an extension? Was thinking of going that path to group the scripts I have, rather than running them from actions first.

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 ,
Mar 19, 2023 Mar 19, 2023
LATEST

No, I don't think so as quite a few extensions allow you to load and run scripts.

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