I used to have a great script that gave me three functions on the middle mouse button, depending on how long it was held down. The three options were short click, long click, or click and hold past a certain time. I had done it with keywait, but that stopped working when I switched to a different (logitech) mouse. So I redid the script like this:
Code: Select all
Global MediumClickSpeed := 325
Global LongClickSpeed := 550
MButton::SetTimer, MButtonLongPress, -%LongClickSpeed% ;Held middle click
MButton UP::
If (A_PriorHotkey == "MButton") {
;MsgBox %A_PriorHotkey%, %A_TimeSincePriorHotkey%
SetTimer, MButtonLongPress, Off
If (A_TimeSincePriorHotkey > LongClickSpeed) { ;Do nothing, already handled by MButtonLongPress
Return
} ;End If
Else If(A_TimeSincePriorHotkey > MediumClickSpeed) { ;Medium middle click
HomeEnd("Home")
Return
} ;End If
Else { ;Short middle click
Click 2
} ;End Else
} ;End If
Return
MButtonLongPress:
HomeEnd("End")
Return
This worked great and I was happy to finally have the functions back. Then I ran windows update and rebooted the machine. Now it doesn't work anymore. Near as I can tell from running some diagnostics, the MButton event isn't firing until the button is released, instead of when the button is pressed, as it is supposed to and as it did yesterday. Enabling the message box line in the code reveals that the time since the prior hotkey is always zero, which makes sense if the MButton event is firing on button up, so both hotkeys essentially run at the same time. What I can't figure is why. The key history shows the down and up events, separated in time by the correct amount, so I'm kind of at a loss. What's a bit odd in the key history is that the down event is type A and the up event is type H. Maybe that's a clue? Any help would be appreciated. Thanks!