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
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
...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.
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)
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?
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.
Copy link to clipboard
Copied
You can also read this instruction on how to assign a script to a hotkey in AutoHotkey.
Copy link to clipboard
Copied
thank you so much!
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!
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.
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.
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!
Copy link to clipboard
Copied
@jduncan @Sergey Osokin thank you both friends! I will give it a try today
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.
Copy link to clipboard
Copied
No, I don't think so as quite a few extensions allow you to load and run scripts.