How to build a toggle button?

Hey guys. :slight_smile:
So here is what I would like to do:

I would like to toggle the shift key, whenever I press my mouse wheel (middle_mouse_button), in order to enable horizontal scrolling, without having to hold any buttons down. (I'm lazy af btw)

So pressing the mouse wheel once, should activate the shift key, and the second click should deactivate it.

I'm aware, that similar questions have been asked before. Unfortunately however I wasn't able to get the previously discussed solutions working for me. Please be aware, that I have limiting programming/coding knowledge at best :slight_smile:

I tried to follow the instructions above as close as possible, but ran into a few problem very quickly. Firstly, the apps UI has changed quite a bit since then and in my version I can neither find any option to give my trigger a custom name, nor the "other tab".

Here is what I've done so far:
I built 2 separate triggers, which both activate on middle_mouse_down.
Both triggers run as first action the apple script, that I copied from Andreas' Post.

tell application "BetterTouchTool"
	set clickState to get_number_variable "ClickState"
	if clickState is 0 then
		set_number_variable "ClickState" to 1
		trigger_named_async_without_response "middle_mouse_down"
		set_number_variable "ClickState" to 0
		trigger_named_async_without_response "middle_mouse_down"
	end if
end tell

And as second action they activate the shift key, or deactivate respectively.

When I press my middle mouse button now, this happens:
CleanShot 2022-12-04 at 02.49.24

I get this kind of weird black context menu, wherever I click my mouse wheel. :thinking:

As mentioned earlier, I have little to no experience in programming languages, but it seems to me, that I am obviously missing something here, or not? As far as I understand it, the apple script that I found in this forum, is basically just switching the "ClickState" for my shift-key between 0 and 1, whenever the middle mouse button is pressed, right? (I took the liberty, to change both triggers to mouse_middle_down btw. I can't see why one would need too different events. Please correct me if I'm wrong.)

But don't I also need some kind of condition then, which is tied to my trigger?
if ClickState = 0, trigger action shift_up
if ClickState = 1, trigger action shift_down

I don't know, but this would make sense to me. Also isn't there some form of code, that I could use in the advanced options for the trigger, that simply asks for the state of the shift-key?

There are too many things in this whole process, which I don't fully understand at the moment, so I will spare you all the questions I have right now and simply ask you guys:

Can you please help me :))))

Here's: What my UI looks like
Thanks guys

I did it guys!! :-)) It works like a charm.
I found the "other tab" and it turns out, if you simply follow the instructions step by step, you don't run into any problems at all... who would have though..?!


Still I am wondering though, if there wasn't an easier way, to achieve this functionality? Is it possible, to check for the current status of the shift-key (or any given key for that matter) within the advanced options for the trigger? If so, then I could simply use it as a condition for my triggers, or not?

Well I'm very happy it works now :))
Thanks everyone.