2 Replies Latest reply on Oct 28, 2016 7:58 PM by JJMack

    Programmatically create and save Actions

    DBarranca Level 4

      Hi,

      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.

      Retrieving the params and let the Action play the correct thing (without \<javascriptresource\> tags would have been problem #2... So I dropped this route altogether.

       

      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!

      Thank you,

       

      Davide