Skip to main content
Flowgun
Inspiring
July 26, 2026
Question

reset current brush settings via scripting?

  • July 26, 2026
  • 3 replies
  • 31 views

Hello everyone,
I want to create a script to reset the settings of the currently-selected brush to its saved defaults that I can later hotkey or whatever.
- I tried finding the index of the currently-selected brush and selecting based on that, but I was not able to do that successfully.
- I tried to write scripts for “Next Brush” and “Previous Brush” to call them in succession in the script, but I was also not able to do that (I don’t want to be sending their hotkeys as they can be mapped differently per user).

Is there any way to achieve what I’m looking for?
 

3 replies

c.pfaffenbichler
Community Expert
Community Expert
July 27, 2026

Possible work-around is creating a new Brush Preset to determine the name of the selected Brush Preset. 

I included a check for the Brush Tool being selected, if other Tools are involved another approach might be better. 

// reset brush to selected brush preset;
// 2026, use it at your own risk;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var theTool = typeIDToStringID(applicationDesc.getEnumerationType(stringIDToTypeID("tool")));
// if brush tool;
if (theTool == "paintbrushTool") {
// get list of brushes;
var theBrushes = brushName(0);
// create new brush;
var aNewName = "deleteThis"+String(Math.random());
createNewBrush (aNewName);
// get new list of brushes and check;
var theNewBrushes = brushName(0);
for (var m = 0; m < theNewBrushes.length; m++) {
if (theNewBrushes[m] == aNewName) {theBrushName = theNewBrushes[m-1]};
};
// remove brush;
deleteSelectedBrush ();
// check for multiples in list;
var theMatches = new Array;
for (var m = 0; m < theBrushes.length; m++) {
if (theBrushes[m] == theBrushName) {theMatches.push(m)}
};
switch (theMatches.length) {
case 1:
selectBrush (theBrushName);
break;
case 0:
alert ("brush missing");
break;
default:
alert ("please clean up your brushes panel");
break
};
};
////// //////
function createNewBrush (aName) {
// =======================================================
var idmake = stringIDToTypeID( "make" );
var desc10 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref3 = new ActionReference();
var idbrush = stringIDToTypeID( "brush" );
ref3.putClass( idbrush );
desc10.putReference( idnull, ref3 );
var idname = stringIDToTypeID( "name" );
desc10.putString( idname, aName );
var idusing = stringIDToTypeID( "using" );
var ref4 = new ActionReference();
var idproperty = stringIDToTypeID( "property" );
var idcurrentToolOptions = stringIDToTypeID( "currentToolOptions" );
ref4.putProperty( idproperty, idcurrentToolOptions );
var idapplication = stringIDToTypeID( "application" );
var idordinal = stringIDToTypeID( "ordinal" );
var idtargetEnum = stringIDToTypeID( "targetEnum" );
ref4.putEnumerated( idapplication, idordinal, idtargetEnum );
desc10.putReference( idusing, ref4 );
var idcaptureSize = stringIDToTypeID( "captureSize" );
desc10.putBoolean( idcaptureSize, false );
var idcaptureTool = stringIDToTypeID( "captureTool" );
desc10.putBoolean( idcaptureTool, false );
executeAction( idmake, desc10, DialogModes.NO );
};
////// delete brush //////
function deleteSelectedBrush () {
try {
var iddelete = stringIDToTypeID( "delete" );
var desc223 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref3 = new ActionReference();
ref3.putEnumerated( stringIDToTypeID( "brush" ), stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ) );
desc223.putReference( idnull, ref3 );
executeAction( iddelete, desc223, DialogModes.NO );
} catch (e) {alert ("problem")}
};
////// delete brush //////
function deleteBrushes (theName) {
try {
var iddelete = stringIDToTypeID( "delete" );
var desc223 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref3 = new ActionReference();
ref3.putName( stringIDToTypeID( "brush" ), String(theName) );
desc223.putReference( idnull, ref3 );
executeAction( iddelete, desc223, DialogModes.NO );
} catch (e) {alert ("problem")}
};
////// selectBrush //////
function selectBrush (theBrushName) {
var desc4 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putName( stringIDToTypeID( "brush" ), theBrushName );
desc4.putReference( stringIDToTypeID( "null" ), ref1 );
executeAction( stringIDToTypeID( "select" ), desc4, DialogModes.NO );
};
//////
function brushName(x) {
var presetNames = [];
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var desc = executeActionGet(ref);
var List = desc.getList(stringIDToTypeID('presetManager'));
var list = List.getObjectValue(x).getList(charIDToTypeID('Nm '));
for (var i = 0; i < list.count; i++) {
presetNames.push(list.getString(i));
};
return presetNames;
};

 

Stephen Marsh
Community Expert
Community Expert
July 26, 2026

@Trevor.Dennis thanks, if the standard commands don't work as intended, then I may not be able to script this as that is what I would be looking to capture (someone else with deeper knowledge of AM code might be able to though).

Trevor.Dennis
Community Expert
Community Expert
July 26, 2026

@Stephen Marsh ?

I tested making the Fully hard brush preset fully soft, using it and then resetting it.

It returned the brush to its default size, but it was still fully soft.

I tested again with a preset that had pressure settings. I also enabled the airbrush icon in the options bar. After resetting again the options bar was returned to its default state, but brush kept the changes I’d made.

So, the only sure way that I can think of is to delete the folder, and reload it.  The .abr files obviously don’t change unless you export overwriting them.

Stephen is a wiz with scripts, and will be paged by including his ID at the top of this post.