• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Select brush from tool preset and then delete whole tool preset?

Guest
Aug 23, 2017 Aug 23, 2017

Copy link to clipboard

Copied

Hello,

I am trying to create a script that will append a Tool Preset with brushes in the existing tools, select certain brush (in this case brush_one) and delete the rest loaded (appended). I know how to do it with separate brushes saved each in a Tool Preset, but the idea here is to save up HDD space. The other thing is saving space in the script by creating one step for each function of brushes.

This is the code I am trying to achieve as a good result, but without success. Instead selecting brush_one, it selects brush_two and doesn't delete neither brush_one nor brush_two after selection:

function brush_one() {

    function step1(enabled, withDialog) {

        if (enabled != undefined && !enabled) {

            return;

        }

        var dialogMode = withDialog ? DialogModes.ALL : DialogModes.NO;

        var desc1 = new ActionDescriptor();

        var ref1 = new ActionReference();

        var desc2 = new ActionDescriptor();

        var ref2 = new ActionReference();

        var desc3 = new ActionDescriptor();

        var ref3 = new ActionReference();

        var desc4 = new ActionDescriptor();

        var ref4 = new ActionReference();

        var desc5 = new ActionDescriptor();

        var ref5 = new ActionReference();

        ref1.putProperty(cTID("Prpr"), sTID("toolPreset"));

        ref1.putEnumerated(cTID("capp"), cTID("Ordn"), cTID("Trgt"));

        ref3.putEnumerated(sTID("toolPreset"), cTID("Ordn"), cTID("Trgt"));

        ref5.putEnumerated(sTID("toolPreset"), cTID('Ordn'), cTID('Trgt'));

        desc1.putReference(cTID("null"), ref1);

        desc1.putPath(cTID("T   "), new File(app.path + "/Presets/Tools/brushes.tpl"));

        desc3.putReference(cTID("null"), ref3);

        desc5.putReference(cTID('null'), ref5);

        ref2.putName(sTID("toolPreset"), "brush_one");

        ref4.putName(sTID("toolPreset"), "brush_two");

        desc1.putBoolean(cTID("Appe"), true);

        desc2.putReference(cTID("null"), ref2);

        desc4.putReference(cTID('null'), ref4);

        executeAction(cTID("setd"), desc1, dialogMode);

        executeAction(cTID("slct"), desc2, dialogMode);

        executeAction(cTID('slct'), desc4, dialogMode);

        executeAction(cTID("Dlt "), desc3, dialogMode);

        executeAction(cTID('Dlt '), desc5, dialogMode);

    }

    step1();

};

Please, will someone present me a solution to this problem, obviously I am a bad programmer.

Thank you very much in advance,

James

TOPICS
Actions and scripting

Views

257

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 Expert ,
Aug 24, 2017 Aug 24, 2017

Copy link to clipboard

Copied

LATEST

If I understand correctly you are not having success with addressing a brush preset by name (in order to delete it).

But if you have loaded the abr-file in the Script you can be sure the brush presets will be the last ones in the list and subsequently should be able to address them by their indices.

Votes

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