How to Get current toolPreset name jsx
Posted: Sat Jan 27, 2018 7:55 pm
How do I get the name of the active sTID("toolPreset")?
I imagine it’s similar to getting the currently active tool name:
If the active sTID('tool') name is 'paintbrushTool', the active sTID("toolPreset") name may be something like "Charcoal low flow".
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)
P.S. I don’t mean the brush tip shape name (which is an aspect of a brush tool preset)
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)
}