Page 1 of 1

how to create a hotkey being pressed for xx ms and do soemthing

Posted: 21 Nov 2019, 03:04
by takayo97
I want to create a hotkey
left mouse button hold down for xx ms and do a loop for doing something, exit the loop from releasing the button. If press and hold the button again, the loop start and so for

Re: how to create a hotkey being pressed for xx ms and do soemthing

Posted: 21 Nov 2019, 03:33
by Rohwedder
Hallo,
perhaps:

Code: Select all

~*LButton::
While, GetKeyState("LButton","P")
{
	ToolTip,% A_Index
}
ToolTip
Return

Re: how to create a hotkey being pressed for xx ms and do soemthing

Posted: 21 Nov 2019, 05:25
by takayo97
i tried to send char a repeatly while holding down left button, but it didnt work

Code: Select all

~*LButton::
While, GetKeyState("LButton","P")
{

    send a
}

Re: how to create a hotkey being pressed for xx ms and do soemthing

Posted: 21 Nov 2019, 05:39
by Rohwedder
then:

Code: Select all

*LButton::
While, GetKeyState("LButton","P")
{
	send a
}
Return
but LButtons's native function will be blocked!