Skip to main content
Inspiring
July 30, 2014
Question

Organizing actions alphabetically

  • July 30, 2014
  • 4 replies
  • 917 views

Can a Photoshop CC 2014 script handle the task of listing a set of actions alphabetically in the actions pallet?

Is this task scriptable?

This topic has been closed for replies.

4 replies

tssee
Inspiring
December 31, 2015

Thank thought you could do with scripts.

tssee
Inspiring
December 30, 2015

I wonder if it is possible that the window does not close after he did his job, and can stay open to start other actions?

JJMack
Community Expert
Community Expert
December 31, 2015

As I wrote that would be possible with a  Photoshop Extension. They add Photoshop Palette type windows to Photoshop.  Scripts can not add Photoshop Palette type windows to Photoshop.

JJMack
ojodegatoAuthor
Inspiring
August 7, 2014

I am looking for a way to organize the actions in the action pallet. Listing them alphabetically in the action pallet would be big help. Alternatively saving a work space with a particular action set would also work. However, I have not been able to save a works space with just one specific action set.

It would be super useful if Photoshop could allow to save fully customizable work spaces including actions sets and the interface colors. 

JJMack
Community Expert
Community Expert
August 7, 2014

You will get no argument from any user the action palette, other palettes and menu needs to be re-implemented in a way they can be better organised for better access. Scrolling menu list a line at a time is ridicules if you have hundreds of items and you can not even create sub-list. You can not nest actions sets etc. etc Photoshop's UI diffidently needs work. We do not need more panels we need panels that can easily be organized the way want to fit in with our work-flows.

The only crash I have had in CC 2014 was cause by expanding many action so I could read the step setting.  The Action Palette became non operational.  However I could close down Photoshop. But when I started CC 2014 up again  the Actions Palette displayed empty and CC 2014 crashed,

I just tried the updated CC 2014.1 problem still there.  This time I did not close down Photoshop I tried to open a new document That cause Photoshop to hang. I had to use the task manager to terminate CC 2014.  When I started CC 2014.1 the Actions Palette use still intact and not expanded. I did not have to recover

"C:\Users\John J McAssey\AppData\Roaming\Adobe\Adobe Photoshop CC 2014\Adobe Photoshop CC 2014 Settings\Actions Palette.psp" from backup like I had to when I shut down Photoshop.

JJMack
tssee
Inspiring
December 30, 2015

Sorry for the question but there is a possibility to remain active script window without closing it after the action?

JJMack
Community Expert
Community Expert
August 6, 2014

Do you want the script to reorder actions in a set in the actions palette or do you want to create a dialog that you can select a loaded action set and get the actions in it in a sorted list. I think the dialog would be possible by sorting the arrays of retrieve loaded actions set names and sorting retrieved actions names.  There was a package available at one time for organizing ones Action palette.  It most like used Action manager code to delete loaded action sets and to load action sets.  I never downloaded it.  I did download a script that put up a dialog that let you select a loaded action an run it.  The script name RunAction.jsx here it is:

#target photoshop

app.bringToFront();

function main(){

var dlg=

"dialog{text:'Action Selector',bounds:[100,100,510,240],"+

"panel0:Panel{bounds:[10,10,400,130] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+

"statictext0:StaticText{bounds:[30,10,280,30] , text:'Run Action' ,properties:{scrolling:undefined,multiline:undefined}},"+

"ActionSet:DropDownList{bounds:[10,40,190,60]},"+

"ActionName:DropDownList{bounds:[200,40,380,60]},"+

"button0:Button{bounds:[20,80,120,100] , text:'Ok' },"+

"button1:Button{bounds:[240,80,340,100] , text:'Cancel' }}}";

win = new Window(dlg);

win.center();

var actionSets = new Array();

actionSets = getActionSets();

for (var i=0,len=actionSets.length;i<len;i++) {

  item = win.panel0.ActionSet.add ('item', "" + actionSets);    

};

win.panel0.ActionSet.selection=0;

var actions = new Array();

actions = getActions(actionSets[0]);

for (var i=0,len=actions.length;i<len;i++) {

  item = win.panel0.ActionName.add ('item', "" + actions);    

};

win.panel0.ActionName.selection=0;

win.panel0.ActionSet.onChange = function() {

win.panel0.ActionName.removeAll();

actions = getActions(actionSets[parseInt(this.selection)]);

for (var i=0,len=actions.length;i<len;i++) {

  item = win.panel0.ActionName.add ('item', "" + actions);

  }

  win.panel0.ActionName.selection=0;

};

var done = false;

    while (!done) {

      var x = win.show();

      if (x == 0 || x == 2) {

        win.canceled = true;

        //Cancelled

        done = true;

      } else if (x == 1) {

        done = true;

       var result = valiDate();

        if(result != true) {

        alert(result);

        return;

        }else

        {

        alert(win.panel0.ActionName.selection.text + " " + win.panel0.ActionSet.selection.text);

        doAction(win.panel0.ActionName.selection.text, win.panel0.ActionSet.selection.text);

        }

      }

   }

}

main();

function valiDate(){

return true;

};

function getActionSets() {

cTID = function(s) { return app.charIDToTypeID(s); };

sTID = function(s) { return app.stringIDToTypeID(s); };

  var i = 1;

  var sets = [];

  while (true) {

    var ref = new ActionReference();

    ref.putIndex(cTID("ASet"), i);

    var desc;

    var lvl = $.level;

    $.level = 0;

    try {

      desc = executeActionGet(ref);

    } catch (e) {

      break;    // all done

    } finally {

      $.level = lvl;

    }

    if (desc.hasKey(cTID("Nm  "))) {

      var set = {};

      set.index = i;

      set.name = desc.getString(cTID("Nm  "));

      set.toString = function() { return this.name; };

      set.count = desc.getInteger(cTID("NmbC"));

      set.actions = [];

      for (var j = 1; j <= set.count; j++) {

        var ref = new ActionReference();

        ref.putIndex(cTID('Actn'), j);

        ref.putIndex(cTID('ASet'), set.index);

        var adesc = executeActionGet(ref);

        var actName = adesc.getString(cTID('Nm  '));

        set.actions.push(actName);

      }

      sets.push(set);

    }

    i++;

  }

  return sets;

};

function getActions(aset) {

cTID = function(s) { return app.charIDToTypeID(s); };

sTID = function(s) { return app.stringIDToTypeID(s); };

  var i = 1;

  var names = [];

  if (!aset) {

    throw "Action set must be specified";

  }

  while (true) {

    var ref = new ActionReference();

    ref.putIndex(cTID("ASet"), i);

    var desc;

    try {

      desc = executeActionGet(ref);

    } catch (e) {

      break;    // all done

    }

    if (desc.hasKey(cTID("Nm  "))) {

      var name = desc.getString(cTID("Nm  "));

      if (name == aset) {

        var count = desc.getInteger(cTID("NmbC"));

        var names = [];

        for (var j = 1; j <= count; j++) {

          var ref = new ActionReference();

          ref.putIndex(cTID('Actn'), j);

          ref.putIndex(cTID('ASet'), i);

          var adesc = executeActionGet(ref);

          var actName = adesc.getString(cTID('Nm  '));

          names.push(actName);

        }

        break;

      }

    }

    i++;

  }

  return names;

};

JJMack