I have added the Volume Slider Widget trigger to my touch bar. I have set 10% for Trigger after sliding. Then I added a Run AppleScript async action to it, that looks like this:
on bttWidgetSliderMoved(newSliderValue)
display dialog "OK"
end bttWidgetSliderMoved
However, this never seems to run, no matter how much I slide my volume widget.
ah it has been a few years since I looked into this.
Unfortunately you are right, Apple Scripts displaying UI won't work with these at all, regardless of whether it's run in background or foreground. Worse: they will lock up the Apple Script runner process, so after running such a script you need to restart BTT.
If you need to display UI from within such a slider, try this to show a BTT HUD:
on bttWidgetSliderMoved(sliderValue)
tell application "BetterTouchTool"
trigger_action "{\"BTTPredefinedActionType\": 254, \"BTTHUDActionConfiguration\": \"{\\\"BTTActionHUDDetail\\\":\\\"hud detail text\\\",\\\"BTTActionHUDTitle\\\":\\\"hud title\\\",\\\"BTTActionHUDDuration\\\":\\\"0.7\\\",\\\"BTTActionHUDBackground\\\":\\\"38.719535, 38.720697, 38.720067, 213.662109\\\",\\\"BTTActionHUDSlideDirection\\\":0}\"}"
end tell
end bttWidgetSliderMoved
Thanks for looking into this. I need this event in order to set different icon depending on system volume percentage. I need to mimic default volume button behavior.