Page 1 of 1

SetKeyDelay problem

Posted: 21 Apr 2018, 07:19
by Keal_Legaxy
At first, I tried to make a macro for combo that spams left mouse button as fast as possible then delay 25ms then press down F button for 265ms

Code: Select all

~LButton::
While GetKeyState("LButton")
{
send {lbutton}
SetKeyDelay, 25,265
sendevent,{f},
}
return
It turned out to spam left mouse button only. :o So I tried applying delay for both buttons.

Code: Select all

~LButton::Toggle:=!Toggle
While !Toggle
{
SetKeyDelay, 25,265
sendevent,{f},{lbutton}
}
return
Now it does not work at all. :headwall:

Could anyone help me fix this problem? I have just started using AHK. I have already read documents about key delay but did not understand. :crazy:

Re: SetKeyDelay problem  Topic is solved

Posted: 21 Apr 2018, 08:07
by Rohwedder
Hallo,
try:

Code: Select all

~LButton::
SetMouseDelay, 25,265 ;affects mouse (LButton, Click, …)
SetKeyDelay, 25,265 ;affects keyboard (a, b, …)
While GetKeyState("LButton","P")
{
	SendEvent,{Click}f
}
Return

Re: SetKeyDelay problem

Posted: 21 Apr 2018, 10:45
by Keal_Legaxy
Thank you a lot. I have just try it out and it works perfectly fine.