I imagine it’s similar to getting the currently active tool name:
Code: Select all
cTID = function(s) { return app.charIDToTypeID(s)}
sTID = function(s) { return app.stringIDToTypeID(s)}
function get_tool() {
var ref = new ActionReference()
ref.putEnumerated(cTID("capp"), cTID("Ordn"), cTID("Trgt"))
return typeIDToStringID(executeActionGet(ref).getEnumerationType(sTID('tool')))
}
alert(get_tool())
I’ve tinkered and looked around but haven’t made any progress. I'd be grateful for any help.
There was a discussion on this over here: https://forums.adobe.com/message/10048743#10048743 but the answer looks too verbose for what I’m thinking.
In case it’s helpful, here is how I’ll use this name to reset the tool preset at the end of the script (as the actions change it)
Code: Select all
function set_tool_preset(name_obtained_at_start_of_script) {
var desc1 = new ActionDescriptor()
var ref1 = new ActionReference()
ref1.putName(sTID("toolPreset"), name)
desc1.putReference(cTID('null'), ref1)
executeAction(cTID('slct'), desc1, DialogModes.NO)
}