Photoshop tool preset list, by current/active tool?
Ok so I know that this has been asked before but In a more general way(recently). I'm trying to get the list of toolpresets but only those of the active tool selected. So If I have the Brush tool selected, It would only scan/output for just the brush tool. I know you can do the tool presets list as a whole(see script below), but I'm trying to run a make new tool preset option(not the default) that you input the tool preset name you want, It scans the current active tool presets to see if that name exists, if it does already exist it error messages and restarts the input process again, halting. I can get it to check the whole list and work fine, but I'd like ONLY to check by active tool selected, so it only checks those of that type vs the entire list. By default photoshop already does it, it only checks the list of the tool you are using, i'm trying to do the same. Other wise as it stands now if there is a name for example in the eraser tool presets, and i try inputting that name as a regular brush tool preset, it finds the name and says i cannot process because the name already exists(in erasers), that's why Im asking. I hope this makes sense. What i started with was this script on the forums: |
function getToolPresetNames() {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var appDesc = executeActionGet(ref); var List = appDesc.getList(stringIDToTypeID('presetManager'));
var presetNames=[];
var list = List.getObjectValue(7).getList(charIDToTypeID('Nm '));
for (var i = 0; i < list.count; i++) {
var str = list.getString(i);
presetNames.push(str); } r
eturn presetNames;}
