Hi. I'd like to know if a certain preset is active or not. Is there any variable for it? Or any other way to query the state of it?
there is the get_preset_details function that could be used.
Either from Apple Script:
tell application "BetterTouchTool" to get_preset_details "thePresetName"
or Java Script (this example would set the variable "presetActive" to the active state of the preset. The activated property can be 0 (preset disabled), 1 (preset enabled) or 2 (preset is master preset and enabled)
async function someJavaScriptFunction() {
let presetDetails = await get_preset_details({name: "theNameOfThePreset"});
await set_number_variable({variableName: "presetActive": presetDetails[0].activated};
return presetDetails;
}
Example output:
[
{
"uuid" : "F8367505-8409-4828-B5FA-8596932687F4",
"hidden" : 0,
"name" : "thePresetName",
"activated" : 2,
"color" : "30.069600, 113.581080, 136.680000, 255.000000"
}
]
Thanks!. I think there is a small typo in the function. This is what works for me
async function someJavaScriptFunction() {
let presetDetails = await get_preset_details({name: "theNameOfThePreset"});
await set_number_variable({variableName: "presetActive", presetActive: presetDetails[0].activated});
return presetDetails;
}