Jorge Luque
Jorge Luque

Reputation: 465

AutoHotkey - How to use 3 different possible combinations?

I want to use these three hotkeys:
- left shift and wheeldown to scroll down twice
- left control and wheel down to scroll down 4 times
- left shift and left control and wheeldown to scroll down 8 times

This is what I have so far but when I input the commands nothing happens

Lshift & wheeldown:: 
GetKeyState,state1,LShift
GetKeyState,state2,LControl
if (state1 = d) and (state2 = u)
   send {wheeldown 2}
if (state2 = d) and (state1 = u)
   send {wheeldown 4}
if (state1 = d) and (state2 = d)
   send {wheeldown 8}
return

Upvotes: 1

Views: 2075

Answers (1)

Robert Ilbrink
Robert Ilbrink

Reputation: 7963

See my same answer in Super User

I would do it this way:

$+WheelDown::SendInput, {WheelDown 2}
$^WheelDown::SendInput, {WheelDown 4}
$+^WheelDown::SendInput, {WheelDown 8}

The $ sign is to prevent a loop where SendInput wheeldown would potentially trigger the same script over and over again since the user holds one of the modifier keys already.

Upvotes: 2

Related Questions