Page 1 of 1

While GetKeyState multiple keys?

Posted: 20 Oct 2017, 16:23
by rover200vi
Hello Guys, I created a macro like this:

Code: Select all

MButton::
While GetKeyState("MButton","P")
{
	Click
	sleep 40
}
This problem is if I hold a key on my keyboard and then hold the MButton it won't register?

While this code works fine even if I press multiple keys and then the MButton but I have other issues with this code.
#IfWinActive does not work for me with this code below.

Code: Select all

MyLabel:
Loop
{
    GetKeyState, state, Mbutton
	if state = D
	{
		loop
		{
			click
			Sleep, 40
			Goto, MyLabel
		}
	}
}

Re: While GetKeyState multiple keys?  Topic is solved

Posted: 20 Oct 2017, 17:16
by Nextron
rover200vi wrote:if I hold a key
Specifically a modifier key like Ctrl or Shift? Your hotkey triggers exclusively to MButton, to make it trigger on any combination of keys with it, prepend it with a *, as in *MButton::.

Re: While GetKeyState multiple keys?

Posted: 20 Oct 2017, 17:54
by rover200vi
Thanks that worked.