Right but I am trying to load & run the action from a file or variable.
I am trying to avoid my group manually loading the correct action sets as they are constantly being updated.
Right but I am trying to load & run the action from a file …
You work with Illustrator CS6+ ?
You can do something like this:
app.loadAction (new File("Your/FilePath"+'/yourActionFile.aia')); app.doScript('scriptName', 'setName');
where do you get the error? loading the actions or playing them?
I don't know how to build a file on a mac, but it seems you need to supply a file object instead of a string (file full path)
var userDesktop = Folder.desktop; var f = new File(userDesktop+'/yourActionFile.aia'); // make a file object first, using a string app.loadAction (f); // the argument here is a file object app.doScript ('actionName', 'actionSetName');
Do you know how I can check to see if the action set exists before I load it?
Thanks in advance!
No I don't, unless maybe you export the action sets and parse the file contents.
On the other hand, you can just play your action, if it doesn't exists, catch the error and load it, run again
Hey! Thanks for the quick reply!
I did find the:
and I put that in a try statement to prevent a crash if the action wasn't there when this was executed;
So when my Palette loads I did the app.loadAction("actionfile.aia");
Then I put the unload action on the close event of the window
This actually works perfect for me because the actionset file is on the server and can be updated and when each user loads the Palette they get the latest version of the scripts with it .
Thanks so much everyone for all the help on here!
Oh that works as well. Great