Copy link to clipboard
Copied
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:
Thanks for any clarification or insight.
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 (Ma
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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)
Copy link to clipboard
Copied
Thank you! I'll try this out
Find more inspiration, events, and resources on the new Adobe Community
Explore Now