user2135836
user2135836

Reputation:

Switch scrolling direction with shortkey

I currently have an AHK script which switches the scrolling direction of my mouse.

WheelUp::
Send {WheelDown}
Return

WheelDown::
Send {WheelUp}
Return

My colleagues don't like this and use my computer sometimes.

How can I assign a shortkey to switch the scrolling direction?

What I want:
When I press win+z the scrolling direction is changed, when I pres win+z again, the scrolling direction is changed back.

So basically the scrolling direction can be changed when pressing win+z

Is that possible with AHK?

Upvotes: 0

Views: 205

Answers (1)

user1944441
user1944441

Reputation:

Yes you can modify your hotkeys to have more code.
You will have to use if statements and variables.

Example:

global direction := 1

^s::    ; ctrl + s will launch this code you can modify this to win + z
    direction := Mod( direction + 1 , 2 ) ; alternates values of direction between 1 and 0
return

WheelUp::
    if(direction)
        Send {WheelDown}
    else
        Send {WheelUp}
Return

; and reverse for wheeldown

Upvotes: 2

Related Questions