Andre Nguyen
Andre Nguyen

Reputation: 3

How to get all the tools in the tool bar using JavaScript in Photoshop

I can find the current tool using this script:

function findCurrentTool() {
    var ref = new ActionReference();
    ref.putEnumerated(charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
    var cTool = typeIDToStringID(executeActionGet(ref).getEnumerationType(stringIDToTypeID("tool")));
    return cTool;
}

and select tool:

function selectTool(tool) {
    var desc9 = new ActionDescriptor();
        var ref7 = new ActionReference();
        ref7.putClass( app.stringIDToTypeID(tool) );
    desc9.putReference( app.charIDToTypeID('null'), ref7 );
    executeAction( app.charIDToTypeID('slct'), desc9, DialogModes.NO );
};

But I can't figure out how to get all the tools in the tool bar.

If you know the answer, please help me. Thank you.

Upvotes: 0

Views: 52

Answers (0)

Related Questions