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.

Known Participant
May 19, 2015

That is / was my #1 reason for actions via script, when CS6 first came out, is the Flatten Transparency. I had discovered that FT is one of the single best useful commands when it came to my production art, because it eliminated clear paths (something that you get when designers outline fonts and use them in a pathfinder ops, so that the hold of an "O" fills in with a clear path, which causes problems later) ,it outlined strokes, so that artists wouldn't accidentally scale strokes wrong, and of course the font-outlining and appearance-flattening. Such as when you have an arched text, but script doesn't know appearance bounds. Also, I noticed it helped with some Illustrator-internal script (MRAP, anyone?) errors from documents we'd open which came from outside the building.


Yea I'm in production art too so I can relate to almost everything you said haha. I also like that it gets rid of groups within groups as well so it's just one simple group with paths and compound paths, a lot easier to script. I started out with CS6 so I didn't know it was new. That must have been tough not having it lol.