• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Programmatically create and save Actions

Advocate ,
Oct 23, 2016 Oct 23, 2016

Copy link to clipboard

Copied

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

TOPICS
Actions and scripting

Views

979

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Oct 28, 2016 Oct 28, 2016

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 🙂

 

Davide

Davide Barranca

HTML Panels

Votes

Translate

Translate
Adobe
Advocate ,
Oct 28, 2016 Oct 28, 2016

Copy link to clipboard

Copied

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 🙂

 

Davide

Davide Barranca

HTML Panels

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 28, 2016 Oct 28, 2016

Copy link to clipboard

Copied

LATEST

xtools ++++1

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines