• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

285

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

People's Champ , 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
...

Votes

Translate

Translate
Adobe
People's Champ ,
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");
 
 
 

Votes

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

LATEST

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

Votes

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