Skip to main content
Participant
October 28, 2025
Answered

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

  • October 28, 2025
  • 2 replies
  • 138 views

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.

Correct answer Sergey Osokin

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)

2 replies

Sergey Osokin
Sergey OsokinCorrect answer
Inspiring
October 29, 2025

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)

Participant
October 29, 2025

Thank you! I'll try this out 

Have a wonderful day
jduncan
Community Expert
Community Expert
October 28, 2025

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!