Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Toggle Tool Presets

$
0
0

hi, this is a follow-up on another thread concerning toggling between a brush tool preset and an eraser tool preset. I've assembled the following script (mostly from csuebele) to try to toggle between "AIRBRUSH 1" (brush tool preset) and "Eraser Chiseled" (eraser tool preset). But it only works for the eraser tool preset when the eraser tool is active. It won't work with the brush tool preset whenever the brush tool is active, it gives an error "The command "select" is not currently available".

 

function getCurrentTool(){       var ref = new ActionReference();           ref.putEnumerated( charIDToTypeID( "capp" ),


charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
        var desc1 = executeActionGet(ref);       desc1 = desc1.getList(stringIDToTypeID("tool"));         desc1 = desc1.getEnumerationType(0);         desc1 = typeIDToStringID(desc1);         return desc1;    }       if(getCurrentTool() == "brushTool"){       


// =======================================================
var idslct = charIDToTypeID( "slct" );
    var desc3267 = new ActionDescriptor();    var idnull = charIDToTypeID( "null" );        var ref1620 = new ActionReference();        var idtoolPreset = stringIDToTypeID( "toolPreset" );        ref1620.putName( idtoolPreset, "AIRBRUSH 1" );    desc3267.putReference( idnull, ref1620 );
executeAction( idslct, desc3267, DialogModes.NO );
// =======================================================                   }else{             var idslct = charIDToTypeID( "slct" );    var desc3276 = new ActionDescriptor();    var idnull = charIDToTypeID( "null" );        var ref1625 = new ActionReference();        var idtoolPreset = stringIDToTypeID( "toolPreset" );        ref1625.putName( idtoolPreset, "Eraser Chiseled" );    desc3276.putReference( idnull, ref1625 );
executeAction( idslct, desc3276, DialogModes.NO );          }

Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>