Tool Presets: how to delete or overwrite?
I'm trying to delete a Tool Preset by name. The usage would be something like this:
deleteToolPreset("favTool1");
saveToolPreset("favTool1");
It seems easy and obvious but its not working for me:
function deleteToolPreset(toolPresetName)
{
var idDlt = charIDToTypeID( "Dlt " );
var desc = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref = new ActionReference();
var idtoolPreset = stringIDToTypeID( "toolPreset" );
ref.putName( idtoolPreset, toolPresetName );
desc.putReference( idnull, ref );
executeAction( idDlt, desc, DialogModes.NO );
}
Photoshop doesn't seem to let you overwrite an existing preset. You have to delete it first and it seems the only way to delete it is to first select it and then delete it. By selecting the tool preset you want to delete, you lose the tools settings that you wanted to save in the first place. A vicious cycle.
Any help would be sooo much appreciated.
-alex
