BTT can change features of the system by using the sliderValue from the Touch Bar. I am wondering if I can do the reverse: change the sliderValue by reading properties of the system. For my use case, I would like to make a slider to scrub through Spotify songs. I can set the song position by running
on bttWidgetSliderMoved(sliderValue) tell application "Spotify" set player position to sliderValue * (duration of current track) / 1000 end tell end bttWidgetSliderMoved
This will jump the song to the right spot, but as the song continues to play, the slider obviously doesn't move.
If I try something like
set sliderValue to 0.5
or something, that doesn't work.
How can I update the sliderValue based on another variable?
P.S. this is also useful for other purposes. For example, the example script of changing the volume doesn't update if you change the volume using the System slider. I think this example slider should also update based on the current volume.