I'm working on a Panel which acts as a GUI for scriptable Plug-ins.
I'd like to feature "action recordability", but I've not been able to make an HTML Panel leave a trace in the Action palette: I've tried to set app.playbackParameters to a descriptor (as I'd do with regular scripts), to no avail.
A very different approach would be to make the panel create out of nothing an action and load it in the Actions panel (so that it can be used as a LEGO brick). I know xbytor2 has libs for Actions, he may give his opinion on what follows – the idea could be like:
– User presses a "build action" button
– Panel retrieves GUI parameters and writes a script file on disk (which content is: run the scriptable plugin passing params)
– Panel "builds" an action calling that very script.
– Panel loads that action in PS.
Given that the above is feasible (is it?), I wonder how I could build/load a single action into an existing ActionSet.
Say that the Panel has already created the ActionSet, which contains 1 Action. What should I do – save the entire ActionSet on disc, convert it to xml, add the new action, convert it back to .atn, load it? What about the existing set? I've the feeling it'll be a tad overkill.
Thoughts and suggestions are welcome!
I've solved the situation with the following hack.
I'm building the Action from an XML template that I fill at runtime and save to a temp folder; then I use xtools to write and load the .atn file. In case the ActionSet already exists, I read the current xml, append the new Action xml, delete the ActionSet, write and load the new one.
Once more, xtools saved my butt :-)