Skip to main content
Known Participant
May 13, 2015
Answered

Is there a way to clear or delete actions through scripting?

  • May 13, 2015
  • 1 reply
  • 8759 views

Hello Everyone!

Menu Commands Outline Stroke

I'm trying to make a script that will clear and then reload actions to try to get around that bug. Thanks to quertyfly and moluapple I now know how to make actions through script so all I need to know if there is a way to clear actions through script.

Thanks Everyone!

This topic has been closed for replies.
Correct answer Qwertyfly___

as a place to get started.

do we even know if sendScriptMessage can do anything with the ActionPalette?

if you know of an example that can achieve something then we would have somewhere to start.


Woo Hoo....

feeling a bit stupid that I had not tried this.

But it works.

You don't even need to first unload each action

to remove a set...

app.unloadAction('Test Set','');

now to activate the file menu...

1 reply

Qwertyfly___
Braniac
May 14, 2015

this is a tricky one...

initial problem:

scripts can be added to an action so we can run via a keyboard shortcut,

BUT, on restart the scripts are not loaded back into the action.

added issue:

removing the action set and loading it again from a saved '.aia' file does not work.

To get this to work we first need to wake the illustrator script menu.(dumbfounded expression)

This is just a matter of opening the File menu. (I do this by pressing "ALT" then "f" then "ESC")

now the actions can be loaded and attached scripts will be linked in correctly.

What we Can do:

We can add an action set and actions to the action panel via a script.

We can load the above actions using a Startup script.

We can unload a script from the actions panel.

What we Can't do: ( or more to the point, What I Can't work out how to do:...)

I can't work out how to remove an action set.

When actions are added via a startup script, it does not register any linked scripts

I can't work out how to activate the file menu via a script.

Known Participant
May 14, 2015

Thanks for your help, I definitely learned something.

I was ignorant on the real cause of the script actions not registering when you reloaded them. On my own trial and error I found a way that always worked, by opening a new file (through the menu), and then loading the actions. I thought by opening a file via script, then loading the actions, then closing the file it would solve the not registering issue. I now know that I was wrong, opening a file does nothing, like you said, all that matters is opening the file menu. I tested this by instead of going to file < new through the menu like I would always do, I hit control N for a new file instead, then I loaded my script actions, and none of them registered.

So crap, that is another issue I was not prepared for haha. So we are two steps away instead of one.

Silly-V
Braniac
May 18, 2015

Nice, they must have fixed that. If I try to do that with CS6 it just crashes my Illustrator. So I just leave those scripts on my desktop instead. Ill hope we get CC eventually.


Hey, I quite possibly take back about 50% of stuff I said on this thread, because I had done some experiments with actions and scripts last weekend and I was surprised things did not come out as I had expected. We were using CC2014, and I was trying to play an action which had a script in it, but the action was also playing an action before the script was to be played. It didn't work, complaining that the "{{script-name}} object does not exist".  The same action did work when I switched the order, and made the script play first, then play the nested action. I really did not get a chance to test scripts playing actions when launched via action, but this one discrepancy makes want to not trust the actions palette even more.