Limit key press

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
KundryWag
Posts: 2
Joined: 22 Jul 2016, 07:43

Limit key press

22 Jul 2016, 07:56

Hi.

I would like to be able to type 'j' at most twice in a short period of time. So it would not be possible to type "jjj" fast.

I think I found how to set a timer to a key, but I'm not sure how to extend that to more than one keypress.

Thanks.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Limit key press

22 Jul 2016, 08:26

Code: Select all

$j::
	Send,j
	Sleep,500 ; Limits to one j typed per 500 ms.
return

Edit:
I think I missunderstood, perhaps this is what you want instead

Code: Select all

$j::
	Send,j
	KeyWait, j
	KeyWait, j, D T0.5 	; You have half a second to type the second j
	if !ErrorLevel
		Send,j
	Sleep,2000			; then you have to wait 2 seconds to type j again
return
Last edited by Helgef on 22 Jul 2016, 08:30, edited 1 time in total.
KundryWag
Posts: 2
Joined: 22 Jul 2016, 07:43

Re: Limit key press

22 Jul 2016, 08:30

Thanks. This is a good start. Now, I actually want to be able to type "jj" fast too, but not "jjj", "jjjj" and so on.

Edit: Yes, that's what I wanted. Thanks!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Marium0505, mcl and 349 guests