Skip to main content
Participant
Oct 28, 2025 6:13 PM UTC
Answered

V28.7.9 - MacOS - Setting a shortcut for Illistrator Scripts without the need of an Action

I’m trying to automate some production steps in Illustrator

My script uses:

app.doScript(ACTION_NAME, ACTION_SET_NAME)

to trigger pathfinder and offset actions. When I run it manually (File -> Scripts -> My Script) it works perfectly.

However, when I make an Action that runs this script, Illustrator freezes as soon as it reaches any app.doScript() call.

I understand that Illustrator Actions and scripts run in different execution threads, and it seems like running an Action that runs a script that runs an Action causes a standstill.

I’ve tried alternatives like:

app.executeMenuCommand("OffsetPath")
//OR
app.executeMenuCommand("Live Offset Path")
//Then using expandStyle()

but these don’t allow me to apply predefined offset settings automatically, so using an Action is still the only consistent and accurate approach so far. I've also tried using effects and even then that has shown unsuccessful results.

Ideally, I’d like to give my script its own keyboard shortcut so I can run it directly, without going through an Action (since that’s what causes the freeze, at least thats what I think is causing the issue).

 

Questions:

  1. Is there any supported way to assign a direct keyboard shortcut to a script in Illustrator without using an Action?
  2. Are there known workarounds or best practices for safely calling app.doScript() from a script triggered by an Action?
  3. Am I doing something wrong that I shouldn't be doing?

    For now, I'm sticking with using other scripts shortcut key and then selecting the script.

Thanks for any clarification or insight.

Sergey Osokin
Sergey OsokinCorrect answer
Inspiring
Oct 29, 2025 4:26 AM UTC

The offset effect is applied via the XML string argument in applyEffect().  @m1b done a great job collecting information about Adobe Illustrator effects.

var xmlOffsetPath = '<LiveEffect name="Adobe Offset Path"><Dict data="R ofst 100 I jntp 2 R mlim 2 "/></LiveEffect>';
app.selection[0].applyEffect(xmlOffsetPath);
app.redraw();
app.executeMenuCommand('expandStyle');

 

Josh provided a link to a list of utilities for running scripts with keyboard shortcuts. I'll duplicate it here directly:
* SPAi (Mac OS, free)
* Hammerspoon (Mac OS, free)
* Keyboard Maestro (Mac OS, paid)
* BetterTouchTool (Mac OS, paid)
* AutoHotkey (Windows, free)

4 replies

MikeLe20
Participating Frequently
Nov 16, 2026 11:03 AM UTC

Adding one to Sergey's list, because it fits your case: the script works from File › Scripts and only hangs inside an Action. So skip the Action and put the menu item itself on a key. I built a free Mac app that does that, Super Shortcuts. Pick File › Scripts › your script and press a key, say Caps Lock + O. It's the same as choosing it from the menu, so app.doScript() should behave the way it does now. It's free, with an optional $39 one-time license, and Mac only.

Translate
Sergey Osokin
Sergey OsokinCorrect answer
Inspiring
Oct 29, 2025 4:26 AM UTC

The offset effect is applied via the XML string argument in applyEffect().  @m1b done a great job collecting information about Adobe Illustrator effects.

var xmlOffsetPath = '<LiveEffect name="Adobe Offset Path"><Dict data="R ofst 100 I jntp 2 R mlim 2 "/></LiveEffect>';
app.selection[0].applyEffect(xmlOffsetPath);
app.redraw();
app.executeMenuCommand('expandStyle');

 

Josh provided a link to a list of utilities for running scripts with keyboard shortcuts. I'll duplicate it here directly:
* SPAi (Mac OS, free)
* Hammerspoon (Mac OS, free)
* Keyboard Maestro (Mac OS, paid)
* BetterTouchTool (Mac OS, paid)
* AutoHotkey (Windows, free)

Translate
Participant
Oct 29, 2025 3:00 PM UTC

Thank you! I'll try this out 

Translate
Have a wonderful day
jduncan
Community Expert
Community Expert
Oct 28, 2025 7:08 PM UTC

This comes up quite a bit here actually. Basically, Ai ExtendScript is single threaded so when you initiate an action from a script (first thread) and that action tries to run another script (second thread) Ai is waiting for the first thread to end before it can move on to the second.

 

There is no official support for executing scripts inside of Ai but there are a handful off utilities that can do it for you. Here's a link from @Sergey Osokin that has links and a bit more info on the process. Let us know if you have any issues and we can help sort it out. Cheers!

Translate