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___
Brainiac
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.

Qwertyfly___
Brainiac
May 19, 2015

an action that runs a script that runs an action?


its a bit like my above Javascript that deletes actions, creates a Javascript and a VBscript, runs that VBscript which in turn runs the javascript which adds actions so we can run script from actions.

you would think we all program for Microsoft...