0
How to delete all Action Sets in the Actions Palette
New Here
,
/t5/photoshop-ecosystem-discussions/how-to-delete-all-action-sets-in-the-actions-palette/td-p/1090983
Oct 08, 2008
Oct 08, 2008
Copy link to clipboard
Copied
I'm in need of a piece of JavaScript code that will delete all the Action Sets in the Actions Palette. I've scripted the logic to load the appropriate Action Set once needed but I don't want to end up with duplicates at the end of processing the batch.
Any help would be most appreciated.
TIA, Scott
Any help would be most appreciated.
TIA, Scott
TOPICS
Actions and scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explore related tutorials & articles
Explorer
,
/t5/photoshop-ecosystem-discussions/how-to-delete-all-action-sets-in-the-actions-palette/m-p/1090984#M448382
Oct 08, 2008
Oct 08, 2008
Copy link to clipboard
Copied
It's been done and lives in xtools/xlib/stdlib.js.
Stdlib.deleteAllActionSets = function(confirmDelete) {
if (confirmDelete != false) {
if (!confirm("Do you really want to empty your Actions Palette?")) {
return;
}
}
var sets = Stdlib.getActionSets();
for (var i = sets.length-1; i >= 0; i--) {
Stdlib.deleteActionSet(sets.name);
}
};
Stdlib.deleteAllActionSets();
Stdlib.deleteAllActionSets = function(confirmDelete) {
if (confirmDelete != false) {
if (!confirm("Do you really want to empty your Actions Palette?")) {
return;
}
}
var sets = Stdlib.getActionSets();
for (var i = sets.length-1; i >= 0; i--) {
Stdlib.deleteActionSet(sets.name);
}
};
Stdlib.deleteAllActionSets();
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Scott_Miles_
AUTHOR
New Here
,
/t5/photoshop-ecosystem-discussions/how-to-delete-all-action-sets-in-the-actions-palette/m-p/1090985#M448389
Oct 09, 2008
Oct 09, 2008
Copy link to clipboard
Copied
I've targeted Photoshop and run this code as shown. I've also copied it directly out of the xtools library but I'm not having any luck.
Run as shown, I get the error "stdlib is undefined".
I've also removed all references in the code to "stdlib" and the code runs thru the if statements and then returns an error "getActionSets" is not a function.
Could someone clue me in; I'm lost?
Run as shown, I get the error "stdlib is undefined".
I've also removed all references in the code to "stdlib" and the code runs thru the if statements and then returns an error "getActionSets" is not a function.
Could someone clue me in; I'm lost?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/photoshop-ecosystem-discussions/how-to-delete-all-action-sets-in-the-actions-palette/m-p/1090986#M448390
Oct 09, 2008
Oct 09, 2008
Copy link to clipboard
Copied
> Could someone clue me in; I'm lost?
getActionSets = function() {
var i = 1;
var sets = [];
while (true) {
var ref = new ActionReference();
ref.putIndex(cTID("ASet"), i);
var desc;
var lvl = $.level;
$.level = 0;
try {
desc = executeActionGet(ref);
} catch (e) {
break; // all done
} finally {
$.level = lvl;
}
if (desc.hasKey(cTID("Nm "))) {
var set = {};
set.index = i;
set.name = desc.getString(cTID("Nm "));
set.toString = function() { return this.name; };
set.count = desc.getInteger(cTID("NmbC"));
set.actions = [];
for (var j = 1; j <= set.count; j++) {
var ref = new ActionReference();
ref.putIndex(cTID('Actn'), j);
ref.putIndex(cTID('ASet'), set.index);
var adesc = executeActionGet(ref);
var actName = adesc.getString(cTID('Nm '));
set.actions.push(actName);
}
sets.push(set);
}
i++;
}
return sets;
};
getActionSets = function() {
var i = 1;
var sets = [];
while (true) {
var ref = new ActionReference();
ref.putIndex(cTID("ASet"), i);
var desc;
var lvl = $.level;
$.level = 0;
try {
desc = executeActionGet(ref);
} catch (e) {
break; // all done
} finally {
$.level = lvl;
}
if (desc.hasKey(cTID("Nm "))) {
var set = {};
set.index = i;
set.name = desc.getString(cTID("Nm "));
set.toString = function() { return this.name; };
set.count = desc.getInteger(cTID("NmbC"));
set.actions = [];
for (var j = 1; j <= set.count; j++) {
var ref = new ActionReference();
ref.putIndex(cTID('Actn'), j);
ref.putIndex(cTID('ASet'), set.index);
var adesc = executeActionGet(ref);
var actName = adesc.getString(cTID('Nm '));
set.actions.push(actName);
}
sets.push(set);
}
i++;
}
return sets;
};
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Scott_Miles_
AUTHOR
New Here
,
/t5/photoshop-ecosystem-discussions/how-to-delete-all-action-sets-in-the-actions-palette/m-p/1090987#M448391
Oct 09, 2008
Oct 09, 2008
Copy link to clipboard
Copied
X:
Thanks for the quick response.
I added the additional code you posted above but now I'm getting an error message:
"cTID is not a function"
I am on the Mac platform, could that be the issue?
Thanks for the quick response.
I added the additional code you posted above but now I'm getting an error message:
"cTID is not a function"
I am on the Mac platform, could that be the issue?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/photoshop-ecosystem-discussions/how-to-delete-all-action-sets-in-the-actions-palette/m-p/1090988#M448392
Oct 09, 2008
Oct 09, 2008
Copy link to clipboard
Copied
If you copied this from the post, then you will have a problem. There need to be two spaces after the m in "Nm ". You are working with a naming convention where spaces count. Also, I not sure that there isn't a problem with the use of single and double quotes around Nm.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/photoshop-ecosystem-discussions/how-to-delete-all-action-sets-in-the-actions-palette/m-p/1090990#M448394
Oct 09, 2008
Oct 09, 2008
Copy link to clipboard
Copied
Larry G. Schneider wrote:
> There need to be two spaces after the m in "Nm ".
Yep.
> Also, I not sure that there isn't a problem with the use of single and double quotes around Nm.
Not at all. You can use pairs of ' or pairs of " as you like. I try to use ' for
characters and " for strings like in C, but I'm not as consistent with this in
as I get older.
Scott_Miles@adobeforums.com wrote:
> I added the additional code you posted above but now I'm getting an error
message:
> "cTID is not a function"
>
From xtools/xlib/stdlib.js:
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
-X
> There need to be two spaces after the m in "Nm ".
Yep.
> Also, I not sure that there isn't a problem with the use of single and double quotes around Nm.
Not at all. You can use pairs of ' or pairs of " as you like. I try to use ' for
characters and " for strings like in C, but I'm not as consistent with this in
as I get older.
Scott_Miles@adobeforums.com wrote:
> I added the additional code you posted above but now I'm getting an error
message:
> "cTID is not a function"
>
From xtools/xlib/stdlib.js:
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
-X
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Scott_Miles_
AUTHOR
New Here
,
/t5/photoshop-ecosystem-discussions/how-to-delete-all-action-sets-in-the-actions-palette/m-p/1090989#M448393
Oct 09, 2008
Oct 09, 2008
Copy link to clipboard
Copied
Thanks Larry:
I tried both of your solutions (additional space after the m in "Nm " and I also changed the code to single quotes.
Unfortunately, neither solved the issue, I'm still getting the error code: "CTID is not a function.
I tried both of your solutions (additional space after the m in "Nm " and I also changed the code to single quotes.
Unfortunately, neither solved the issue, I'm still getting the error code: "CTID is not a function.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Scott_Miles_
AUTHOR
New Here
,
LATEST
/t5/photoshop-ecosystem-discussions/how-to-delete-all-action-sets-in-the-actions-palette/m-p/1090991#M448395
Oct 09, 2008
Oct 09, 2008
Copy link to clipboard
Copied
Xbytor wrote:
From xtools/xlib/stdlib.js:
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
>
>
I've added the above to the code; thanks X
Now I'm stuck in the "confirmDelete" loop;
"Do you really want to empty your Actions Palette?"
Story of my life, LOL
From xtools/xlib/stdlib.js:
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
>
>
I've added the above to the code; thanks X
Now I'm stuck in the "confirmDelete" loop;
"Do you really want to empty your Actions Palette?"
Story of my life, LOL
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

