Skip to main content
Participant
April 25, 2009
Question

Tool Presets: how to delete or overwrite?

  • April 25, 2009
  • 1 reply
  • 965 views

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

This topic has been closed for replies.

1 reply

Inspiring
April 25, 2009

Photoshop doesn't seem to let you overwrite an existing preset.

But xtools does:

//@show include

//@includepath "/c/Program Files/Adobe/xtools;/Developer/xtools"

//

//@include "xlib/stdlib.js"

//@include "xlib/PresetsManager.jsx"

var toolsMgr = PresetsManager.getManager(PresetType.TOOL_PRESETS);

toosMgr.renameElement(oldName, newName);

-X