2
votes

I have an autohotkey that accepts double clicking input no problem. I want to also add a 'Push and Hold' function as well, but I'm unable to fully iron out the issues experimenting with it continuously.

Here's the TL;DR

I want a single click of the middle mouse button to send an •

I want a double click of the middle mouse button to send an ▪

I want a push-and-hold of the middle mouse button to send an ◦

Link to the API: https://autohotkey.com/docs/commands/KeyWait.htm

MButton::
KeyWait, MButton
KeyWait, MButton, D T.3
if(!ErrorLevel){
Send ▪ 
}
else{
if(!ErrorLevel){
KeyWait, MButton, D T.2
Send ◦
}
else{
Send •
return
}
}

return

What's wrong with the above?

1

1 Answers

3
votes
MButton::
    KeyWait, MButton, T0.3
    If !(ErrorLevel)
    { 
        Sleep, 300
        If (A_PriorHotKey = "MButton Up") ; double click
            Send ▪
        else                              ; single click
            Send •
    }
    else                                  ; push-and-hold
        Send ◦
return

MButton Up:: return