Page 1 of 1

Hold down a key as long as I'm holding down a mouse button

Posted: 26 Dec 2018, 01:43
by zakirbaig
I want my LShift to be held down as long as I'm holding down my MButton. I wrote the script mentioned below but what it does is locks the LShift key down and does not release it even after I let go of my MButton. Where am I going wrong?

MButton::
Loop {
Send {LShift down}
}Until !GetKeyState("MButton","P")
Return

Re: Hold down a key as long as I'm holding down a mouse button  Topic is solved

Posted: 26 Dec 2018, 03:51
by CyL0N

Code: Select all

MButton::
Send {Shift down}
While GetKeyState(A_ThisHotkey, "P")
	Sleep 10
Send {Shift up}
Return

Re: Hold down a key as long as I'm holding down a mouse button

Posted: 27 Dec 2018, 22:28
by zakirbaig
Thanks, bud. It worked. Also go the logic. :D