Proposed Action: "Set Persistent BTT Variable _ to _" / Preventing Accidental Double Triggers


For a while I have been trying to trigger actions in a way that does not double-trigger, which is important for scroll wheel-triggered events.

I have solved this by using the action "Launch Application/Applescript", where I run an Applescript with the following:

tell application "BetterTouchTool"
	set_persistent_string_variable "customVariable1" to "SOMETHING"
end tell

Then, I have a "conditional activation group" named CAGName whose trigger is

BTT Variable: customVariable1 isSOMETHING

Finally, I have an action with trigger CAG Activated: CAGName whose Assigned Action is my desired action, plus "Launch Application/Applescript" for the following:

tell application "BetterTouchTool"
	delay 0.5
	set_persistent_string_variable "customVariable1" to "waiting"
end tell

This means that if I trigger the original action more than once in 0.5 seconds, actions assigned to the conditional activation group's activation should only happen once.

There are three straightforward better solutions I can think of:

  1. Create a BTT action called "Set Persistent BTT Variable _ to _" (with a GUI interface to change the variable) so that there's no need to call Applescript just to set these variables. This seems like a natural BTT addition to me.
  2. Add a checkbox to the "Delay next action" action that says "disable this action's trigger during delay". This would give triggers double-trigger protection if they included this as an additional action. I guess it would be impossible if "Actions" can't observe their own "Triggers".
  3. Add a checkbox for all triggers that says "Can trigger at most every 0 seconds" with a slider or textbox that controls the value. It could go right next to the "Prevent recursive triggers" checkbox

I don't know if any of these are possible for you! If they are possible and not too hard, I would be SO GRATEFUL if you included any of them. My current setup is very complicated to maintain.

Thank you!

I also want to point out that there are only three BetterTouchTool persistent variables whose values can trigger conditional activation groups: customVariable1, customVariable2, and customVariable3 (and BTTCurrentlyPlaying and BTTCurrentlyPlayingApp, which don't seem general-purpose).

So, my current solution is only possible with limited extendability. I could create conditional activation groups that activate on many different values of the same variable, but the use case I described (especially with the delay) would create some very obvious race conditions.

In any event, it seems to me to be a good idea to allow for more than the built-in persistent variables to trigger conditional activation groups. Otherwise they seem to not be fully supported and I'm hesitant to rely on them much.

1 Like