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

Loop through action sets to save individual actions?

Community Expert ,
Mar 29, 2016 Mar 29, 2016

Copy link to clipboard

Copied

Just wondering if anybody knows of a script that would cycle through all the loaded action sets in the actions palette and save them out as individual ATN files?

I found one of Xbytor’s Xtools scripts to make a backup of the Actions Palette.psp file, however I was looking for something a little more granular…

TOPICS
Actions and scripting

Views

747

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
Adobe
Advisor ,
Mar 29, 2016 Mar 29, 2016

Copy link to clipboard

Copied

Edit the ActionsPaletteToFiles.jsx script. Replace the existing main() function with this code below. I've added a new flag, USE_RUNTIME_PALETTE, that will force the script to read the runtime palette instead of prompting for a file. In the code below, I have the flag turned on. When I push this out to sourceforge and in future xtools releases, this flag will be turned off. Eventually I'll just add a button to the UI.

-X

EDIT: removed some $.writeln() calls.

USE_RUNTIME_PALETTE = true;

function main() {
  if (CSVersion() < 2) {
    alert("Because of missing Javascript APIs, reading binary action files " +
          "is currently only supported in CS2+. Support for CS and possibly " +
          "PS7 may  become available in the future.");
    return;
  }

  var runtime = USE_RUNTIME_PALETTE;
  var test = false;
  var opts;

  Stdlib.log.setFile(Stdlib.PREFERENCES_FOLDER + "/stdout.log");
  Stdlib.log("ExportPalette");

  if (runtime) {
    var fld = Stdlib.selectFolder('Select destination folder for .atn files');
    var iterator = {};
    iterator.exec = function(actSet) {
      var actFile = new ActionFile();
      actFile.actionSet = actSet;
      var nm = actSet.name;
      if (!nm.match(/\.atn$/i)) {
        nm += ".atn";
      }
      actFile.file = new File(this.folder + '/' + nm);
      try {
        actFile.write();
      } catch (e) {
      }
    };

    iterator.folder = fld;
    ap = new ActionsPalette();
    ap.iterateRuntime(iterator);

    return;
  }

  if (!test) {
    var ui = new ExportPaletteUI();
    var opts = ui.run();
  } else {
    opts = {
      source: new File(app.preferencesFolder + "/Actions Palette.psp"),
      output: new Folder("/c/temp")
    };
  }

  if (!opts) {
    return;
  }

  function saveActionSet(actSet) {
    var opts = this.state;
    var actFile = new ActionFile();
    actFile.actionSet = actSet;
    var nm = actSet.name;
    if (!nm.match(/\.atn$/i)) {
      nm += ".atn";
    }
    actFile.file = new File(opts.output + '/' + nm);

    try {
      actFile.write();
    } catch (e) {
    }
  }
  var itr = new ActionsPaletteIterator(opts);
  itr.exec = saveActionSet;
  var palFile = ActionsPaletteFile.iterateOverFile(opts.source, itr);

  return;
};

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 ,
Mar 29, 2016 Mar 29, 2016

Copy link to clipboard

Copied

Thank you! Ah, I was referring to “BackupActions.js”, however I had forgotten about “ActionsPaletteToFiles.jsx”…

That sort of worked xbytor, however when loading the action sets back into Photoshop, the actual action steps are missing, the actions are essentially blank/useless…

Perhaps I did not copy/paste correctly?

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
Advisor ,
Mar 30, 2016 Mar 30, 2016

Copy link to clipboard

Copied

Let me look at it again and see if there is something I messed up. PM me your email address and I'll send you a working file sometime later today or tomorrow.

BTW, you could run BackupActions.js then the unedited ActionsPaletteToFiles.jsx to get the same effect. The only problem with BackupActions is that it doesn't recognize any new actions created since you started your current PS session.

-X

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 ,
Mar 30, 2016 Mar 30, 2016

Copy link to clipboard

Copied

Thanks xbytor, I have 69 actions loaded (some very complex) and the unedited script locks up with spinning wheel of death when it has only saved on 2-3 actions (tried in both CS6 and CC15).

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
Advisor ,
Mar 30, 2016 Mar 30, 2016

Copy link to clipboard

Copied

Some Actions take a long time to process because of stuff like embedded color profiles or something similar that is stored as a binary blob which take a lot of time to process. Wait for an hour to see if they make progress. If not, send me a .psp file to play with.

-X

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 ,
Mar 30, 2016 Mar 30, 2016

Copy link to clipboard

Copied

LATEST

OK, I only waited for 10 minutes and 2 actions are saved out… I’ll give it more time and or look to see if I can figure out which action set is the bottleneck holding things up. This is not a big deal or urgent issue at all, so please don’t expend too much of your valuable time on this now.

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