It is possible to add a delay time between keys?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
TheRockEffect
Posts: 4
Joined: 28 Jun 2017, 20:30

It is possible to add a delay time between keys?

28 Jun 2017, 20:45

I recently tried this tool, I did several experiments that didn't work.
My problem is that when I press "f" it presses itself the "p" after, like automatically. Thought that a solution could be add a waiting time between theese keys.
I tried with a funcionality included in my SO, but it doesn't delays keystrokes between different keys.
You know a way to do this?

Thanks.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: It is possible to add a delay time between keys?

28 Jun 2017, 20:53

Sleep is one way, and it's an easy way to set variation between keys.

But you can also use SetKeyDelay.
TheRockEffect
Posts: 4
Joined: 28 Jun 2017, 20:30

Re: It is possible to add a delay time between keys?

28 Jun 2017, 21:35

Maybe is missing something?

$f::f
sleep, 100

Still presses p after f
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: It is possible to add a delay time between keys?

28 Jun 2017, 21:51

Single line hotkey vs multi-line hotkey.

Not sure which one is supposed to be p (I assume you don't mean to use f remap to f). You might mean this?

Code: Select all

f::
Sleep, 100
Send, p
return
TheRockEffect
Posts: 4
Joined: 28 Jun 2017, 20:30

Re: It is possible to add a delay time between keys?

28 Jun 2017, 22:28

well, I was intending to avoid the pressing of p by doing that, guess it doesn't works like that,
I tested this:
p::
Sleep, 200
It works, I press f and all good, is just that I wanted to do this with the "p" too, because when I push it occurs that pushes "f" (my keyboard is kind of crazy)
So I ran:
p::
Sleep, 200
F::
Sleep, 200
and none of theese keys works
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: It is possible to add a delay time between keys?

28 Jun 2017, 23:28

Oh, your keyboard is wonky. That paints a better picture for me. Here's what I'd do: (untested, I don't have the wonky keyboard)

Code: Select all

~f::
Hotkey, p, ignore
Sleep 100
Hotkey, ~p, ~p
return

~p::
Hotkey, f, ignore
Sleep 100
Hotkey, ~f, ~f
return

ignore:
return
The goal is you use f/p hotkeys with the ~ modifier, which allows the keys to act normally and also execute autohotkey commands. However, the immediate action is to turn on a hotkey for the other key which runs the ignore label. In this case, the ignore label takes no action, but suppresses the key (notice this hotkey doesn't have the ~ modifier). Then after 100 milliseconds, it'll reactivate the starting hotkey with the ~ modifier, which targets itself as a label.
TheRockEffect
Posts: 4
Joined: 28 Jun 2017, 20:30

Re: It is possible to add a delay time between keys?

29 Jun 2017, 00:55

In fact, the "bad keys" are f/p, space/4 and r/0, I ran that script on all and wow! it fixed like 90% of annoying keys, I guess the other percentage is in the wonky keyboard.
Thank you very much! Genius

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Google [Bot], Nerafius and 85 guests