Runing Action Name via Script

Discussion of Automation, Image Workflow and Raw Image Workflow

Moderators: xbytor, Kukurykus, Tom

qwerty1234
Posts: 1
Joined: Fri Oct 05, 2018 5:28 pm

Runing Action Name via Script

Post by qwerty1234 »

Is there a way to Access Action Name and Action Set name from within the running action.
Such script would be helpful in self-documenting images produces by actions.
I see how it can be done with second action calling first, but that is not convenient for my workflow.

If this is not possible - are there any tools that would assist in associating actions and images that they produce.
TIA

User avatar
Dormeur74
Posts: 32
Joined: Mon Oct 03, 2016 4:56 am

Re: Runing Action Name via Script

Post by Dormeur74 »

It is possible, in a script, to know the number and the names of the ActionSets (loaded) and the number and names of the Actions included.
But how to know which action is active when there are more than one ?

It is so simple to insert the action name in the metadatas of the active document at the beginning of an action creation. Each time the action will be used, its name will be inserted in the description of the file.

Geoff
Posts: 5
Joined: Thu Jan 24, 2019 8:18 pm

Re: Runing Action Name via Script

Post by Geoff »

This should work after the action has been run.

Code: Select all

#target photoshop;
getCurrentAction();
function getCurrentAction(){
    var r = new ActionReference();  
    r.putEnumerated(stringIDToTypeID("action"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));               
    try {  
        var ret = executeActionGet(r);       
        var act_name = ret.getString(stringIDToTypeID("name"));  
        var set_name = ret.getString(stringIDToTypeID("parentName"));  
        alert(set_name + "\n\n" + act_name, "Current Action")  
        }  
    catch(e) { alert("No action selected"); } 
};