Runing Action Name via Script

Discussion of Automation, Image Workflow and Raw Image Workflow

Moderators: Tom, Kukurykus

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: 36
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: 10
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"); } 
};
Amaresh1990
Posts: 1
Joined: Mon Jul 13, 2020 7:19 am

Re: Runing Action Name via Script

Post by Amaresh1990 »

Thank you for your help. I'm looking for something like that
User avatar
txuku
Posts: 136
Joined: Thu Jan 01, 1970 12:00 am

Re: Runing Action Name via Script

Post by txuku »

Bonjour

I use this script to do this :

Code: Select all

//Hauteur_largeur.jsx 
//appel de script .atn
//Remplacer scriptHoriz Script 182 et scriptAtnVertic Script 183 
//par leurs references effectives dans vos scripts .atn



if (activeDocument.width> activeDocument.height) 
{
 
  doAction( "Script 182",  "scriptAtnHoriz")
}

else 
{
  doAction( "Script 183",  "scriptAtnVertic")
}