If a key is held, send [action] every [length of time]. Just send keypress if tapped.

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
WhenInWome
Posts: 10
Joined: 10 Sep 2020, 11:59

If a key is held, send [action] every [length of time]. Just send keypress if tapped.

Post by WhenInWome » 13 May 2024, 10:36

Looking for a way to code around my lack of arrow keys on a 60% keyboard. It has a function layer and fn + i/j/k/l sends the four arrow key directions. I'm looking for a way where if I press and hold any of those keys it will send the direction key every [variable length of time, maybe starting at every 0.5s]. I don't want it to interfere with regular typing though, so if I just hit the letters for a normal length of time I want it to register. So only activate if it's held for more than 0.25s maybe.

Rohwedder
Posts: 7719
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: If a key is held, send [action] every [length of time]. Just send keypress if tapped.

Post by Rohwedder » 13 May 2024, 12:46

Hallo,
try:

Code: Select all

#Requires AutoHotkey v2.0
$Up::Send(Keywait("Up", "T.5")?"{Up}":"q"), Keywait("Up")
$Down::Send(Keywait("Down", "T.5")?"{Down}":"w"), Keywait("Down")
You have to test whether the script can press the fn key
https://www.autohotkey.com/docs/v2/KeyList.htm#SpecialKeys

Post Reply

Return to “Ask for Help (v2)”