Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


How to remove loaded brushes?

Explorer ,
Nov 25, 2021 Nov 25, 2021

Copy link to clipboard

Copied

I'm able to load patterns in a way where I can choose to load them appending to the current patterns or not.

When I want to update the patterns, I load the first pattern with appending on false, and the rest on true, resulting in the removal of all previous patterns, and loading the new ones.

I edited this pattern functions to work with brushes, the only thing that isn't working like it is with patterns is the appending function. It will always append, even on false.

Resulting in duplicate brush sets.

Is it posible to remove "all" brushes?

 

function cTID(s){
    return app.charIDToTypeID(s);
    };

function sTID(s){
    return app.stringIDToTypeID(s);
    };

function actionManagerLoadBrushFile(file, append){
    // append: true / false
    
    var d1 = new ActionDescriptor();
    var r1 = new ActionReference();

    r1.putProperty(cTID('Prpr'), sTID('brush'));
    r1.putEnumerated(sTID('application'), sTID('ordinal'), cTID('Trgt'));
    d1.putReference(sTID('null'), r1);
    d1.putPath(cTID('T   '), file);
    d1.putBoolean(cTID('Appe'), append);
    
    executeAction(cTID('setd'), d1, DialogModes.NO );
    }

var brushFile = new File("/C/Brushes/Brushes.abr");
actionManagerLoadBrushFile(brushFile, false)

 

TOPICS
Actions and scripting

Views

64

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Nov 25, 2021 Nov 25, 2021
sTT = stringIDToTypeID; function brshs() { (ref = new ActionReference()).putEnumerated (sTT('application'), sTT('ordinal'), sTT('target')) return executeActionGet(ref).getList(sTT('presetManager')) .getObjectValue(0).getList(sTT('name')).count } while(brshs()) { (ref = new ActionReference()).putIndex(sTT('brush'), 1); (dsc = new ActionDescriptor()).putReference(sTT('null'), ref) executeAction(sTT('delete'), dsc) }

Likes

Translate

Translate
Adobe Community Professional ,
Nov 25, 2021 Nov 25, 2021

Copy link to clipboard

Copied

sTT = stringIDToTypeID; function brshs() {
	(ref = new ActionReference()).putEnumerated
	(sTT('application'), sTT('ordinal'), sTT('target'))
	return executeActionGet(ref).getList(sTT('presetManager'))
	.getObjectValue(0).getList(sTT('name')).count
}

while(brshs()) {
	(ref = new ActionReference()).putIndex(sTT('brush'), 1);
	(dsc = new ActionDescriptor()).putReference(sTT('null'), ref)
	executeAction(sTT('delete'), dsc)
}

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 25, 2021 Nov 25, 2021

Copy link to clipboard

Copied

Not sure how you do it, but works perfectly as always!

 

Would it be posible to remove all patterns except when they are in a specific folder name? I gues this would be a real challenge..

This way I could update all patterns except when people have made a "private brushes" folder, and won't be deleted.

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 25, 2021 Nov 25, 2021

Copy link to clipboard

Copied

LATEST

Thanks to r-binSelect/refer to brushes by name within brush sets by name

sTT = stringIDToTypeID; (ref = new ActionReference())
.putProperty(sTT('property'), sTT('brushes')), ref.putClass(sTT('application'))
brshs = eval('('+ executeActionGet(ref).getString(sTT('brushes')) + ')').brushes

while(brshs.length) (nme = brshs.shift().name) != 'private brushes'
&& ((ref = new ActionReference()).putName(sTT('brush'), nme),
(dsc = new ActionDescriptor()).putReference(sTT('null'), ref),
executeAction(sTT('delete'), dsc))

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines