Skip to main content
Inspiring
Oct 16, 2025 1:42 PM UTC
Question

Script to list all actions

I've got a lot of actions in a lot of actions sets. 

 

There's no easy way to list them - without writing them out by hand. But I'm lazy so I wrote a script to do it:

// Function to get the object value for action sets
function get_action_set_descriptor(index)
{
    var r = new ActionReference();
    r.putIndex(stringIDToTypeID("actionSet"), index);
    return executeActionGet(r);
}

// Function to get the object value for an action within a set
function get_action_descriptor(setIndex, actionIndex)
{
    var r = new ActionReference();
    r.putIndex(stringIDToTypeID("action"), actionIndex);
    r.putIndex(stringIDToTypeID("actionSet"), setIndex);
    return executeActionGet(r);
}

// function WRITE FILE (astring, afilename)
// --------------------------------------------------------
function write_it(astring, afilename)
{
  if (afilename == undefined) afilename = myFile;
  var exportFile = new File(afilename);
  exportFile.open("w"); // write destroys
  exportFile.writeln(astring);
  exportFile.close();
}


// Main function to list all action sets and actions
function list_all_actions()
{
    var msg = "";
    // Get total number of action sets
    var totalSets = 0;
    try
    {
        var desc = get_action_set_descriptor(1);
        totalSets = desc.getInteger(stringIDToTypeID("count"));
    } 
    catch (eek)
    {
        //alert("No action sets found or error retrieving action sets.");
        return;
    }

    for (var i = 1; i <= totalSets; i++) 
    {
        var setDesc = get_action_set_descriptor(i);
        var setName = setDesc.getString(stringIDToTypeID("name"));
        var numActions = setDesc.getInteger(stringIDToTypeID("numberOfChildren"));

        msg += "Action Set: " + setName + " (Total actions: " + numActions + ") + \n"
        // alert(msg);

        // Loop through actions in the set
        for (var j = 1; j <= numActions; j++) 
        {
            var actionDesc = get_action_descriptor(i, j);
            var actionName = actionDesc.getString(stringIDToTypeID("name"));
            var count = actionDesc.getInteger(stringIDToTypeID("count"));
            var itemIndex = actionDesc.getInteger(stringIDToTypeID("itemIndex"));
            var numberOfChildren = actionDesc.getInteger(stringIDToTypeID("numberOfChildren"));
            var parentName = actionDesc.getString(stringIDToTypeID("parentName"));
            var parentIndex = actionDesc.getInteger(stringIDToTypeID("parentIndex"));
            var ID = actionDesc.getInteger(stringIDToTypeID("ID"));

            var info = "Action: " + actionName +
                //"\n  count: " + count +
                //"\n  itemIndex: " + itemIndex +
                //"\n  numberOfChildren: " + numberOfChildren +
                //"\n  parentName: " + parentName +
                //"\n  parentIndex: " + parentIndex +
                "\n  ID: " + ID;

            msg += info + "\n";
            // alert(info);
        }
    }
    return msg;
}

// Run the main function
var info = list_all_actions();
write_it (info, "C:\\temp\\actions.txt");
alert("Done!");

 

Thought it might be useful to someone else other than my future self.

3 replies

Inspiring
Oct 16, 2025 3:56 PM UTC

If I remember correctly, something similar already exists.

Translate
Stephen Marsh
Community Expert
Community Expert
Oct 17, 2025 12:30 AM UTC
quote

If I remember correctly, something similar already exists.


By @Ciccillotto

 

Yes...

 

JSON, on Win, holding down Shift + Alt + Ctrl when selecting Save Actions... from the action panel menu.

 

TXT, on Win, holding down Alt + Ctrl when selecting Save Actions... from the action panel menu.

 

On Mac, swap Cmd for Ctrl and Opt for Alt.

Translate
Inspiring
Oct 20, 2025 12:36 PM UTC

Whaaaat? That's gotta be the single most ridiculous and annoying, hardly advertised, badly thought out, undocumented Photoshop kludge ever. 
Just try to access that menu with Alt + CTRL held down - you can't! it just closes.
Only when the cursor is highlighted and then clicked over the Save Actions option can Alt + CTRL be held down will the window open.

Also there is no explaination as to what Actions.txt is - unless you know or any sense that this will save out a text file of all the actions  not just the selection you had just previously selected.


No wonder I resorted to doing my own thing. Bad Adobe, no biscuit.

Translate