List of keys or a part of list accord the time the key was pressed Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
LuanMts
Posts: 20
Joined: 24 May 2020, 00:36

List of keys or a part of list accord the time the key was pressed

24 May 2020, 01:22

I would like a code that when I held the "x" key , according to the time I held it, performed a different action. For example:

Just click the x: type "a"
Hold x for 30 ms: type "a" as soon as pressed and "b" as soon as 30 ms
Hold x for 60 ms: type "a" as soon as pressed; "b" as soon as it gives 30 ms; and type "c" as soon as 60 ms
Rohwedder
Posts: 7647
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: List of keys or a part of list accord the time the key was pressed  Topic is solved

24 May 2020, 02:34

Hallo,
try:

Code: Select all

$x::
While GetKeyState("x","P") And A_Index < 27
{
	Key := Chr(96 + A_Index)
	Send, {%Key% Down}
	Sleep, 30
	Send, {%Key% Up}
}
Return
LuanMts
Posts: 20
Joined: 24 May 2020, 00:36

Re: List of keys or a part of list accord the time the key was pressed

24 May 2020, 18:18

Very interesting! I don't know how this comands work and the script is typing the whole alphabet!I use "d, e, f..." to other actions. Do you have other script, I was trying using Tickcount but it doesn't work
Thanks for the attention!
Rohwedder
Posts: 7647
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: List of keys or a part of list accord the time the key was pressed

25 May 2020, 02:28

If you only want to type the first 3 letters a - c replace < 27 with < 4

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ccqcl, Descolada and 180 guests