Search code examples
loopssendautohotkeymouseclick-event

AUTOHOTKEY If left mouse pressed.. loop..something


This is my current code:

LButton::

Send {sc013}
Sleep 10
Send {sc021}
Sleep 10
Return


RButton::

Send {sc014}
Sleep 10
Send {sc021}
Sleep 10
Return

And all what I need is... isnsted of when left mouse/right mouse button clicked do something.....

I need that when left/right mouse button HOLDED loop letter "F".
Thnk you.


Solution

  • You'll need to use GetKeyState() and a While-loop. So while Rbutton is pressed, send F.

    Rbutton::
        while (GetKeyState("Rbutton", "P")) {
            Send, F
        }
    return