Check if a set of actions has already been loaded?

Engaged ,
Mar 08, 2021 Mar 08, 2021

Copy link to clipboard

Copied

Good evening! Is there a script that checks if a set of actions "myActions.atn" has already been loaded?
I use an extension in Photoshop that has a script that loads an action set whenever I restart Photoshop or the extension, but it creates a stack with the same set of actions in the action palette and an annoying shortcut conflict message appears with the menu shortcuts. Thanks for the help.

Capturar.PNG

function loadActions () {
	var actionFile =new File("~/desktop/myAction.atn");
    if(actionFile.exists){app.load(actionFile)}
};

loadActions ();
TOPICS
Actions and scripting

Views

61

Likes

translate

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

correct answers 1 Correct Answer

Adobe Community Professional , Mar 08, 2021 Mar 08, 2021
The filename is not always the same as the Action Set name. But you can take this code as a basis.   var my_set_name = "myActions"; var found = false; for (var i = 1;;i++) { var r = new ActionReference(); r.putIndex(stringIDToTypeID("actionSet"), i ); var set_name = null; try { set_name = executeActionGet(r).getString(stringIDToTypeID("name")); } catch (e) { break; } if (set_name == my_set_name) { found = true; break; } } if (found) alert(my_set_name + " alread...

Likes

translate

Translate

Translate
Adobe Community Professional ,
Mar 08, 2021 Mar 08, 2021

Copy link to clipboard

Copied

The filename is not always the same as the Action Set name.
But you can take this code as a basis.
 
var my_set_name = "myActions";
var found = false;

for (var i = 1;;i++)
    {
    var r = new ActionReference();
    r.putIndex(stringIDToTypeID("actionSet"), i );

    var set_name = null;

    try { set_name = executeActionGet(r).getString(stringIDToTypeID("name")); } catch (e) { break; }

    if (set_name == my_set_name) { found = true; break; } 
    }

if (found) alert(my_set_name + " already loaded");
else alert(my_set_name + " was not load");
 
 
 

Likes

translate

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
Engaged ,
Mar 08, 2021 Mar 08, 2021

Copy link to clipboard

Copied

Perfect! My problem has been completely solved. Thanks for the script r-bin

Likes

translate

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