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

Illustrator crashes when call action with app.doscript

Contributor ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

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

Views

873

Translate

Translate

Report

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

Engaged , 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

...

Votes

Translate

Translate
Engaged ,
Jan 26, 2023 Jan 26, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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)

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

thank you so much!

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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!

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.png

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.jpg

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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!

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

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