release all "sticky" keys if held for more than 1 second?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
newcod3r
Posts: 505
Joined: 30 Sep 2021, 02:16

release all "sticky" keys if held for more than 1 second?

Post by newcod3r » 28 Nov 2021, 08:04

I have trouble finding the offending code that sometimes holds down certain keys or modifiers (i.e. shift/alt/ctrl/win/capslock) and hangs my script.

Understand it is not best practice, but is there a way to check for and release all "sticky" keys if held for more than 1 second?

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

Re: release all "sticky" keys if held for more than 1 second?

Post by Rohwedder » 28 Nov 2021, 08:52

Hallo,
Not exactly what you want but maybe?:

Code: Select all

#Persistent
SetTimer, KeysReset, 1000
KeysReset:
IfGreater, A_TimeIdle, 1000, Loop, 0xFF
	SendInput,% GetKeyState(Key:=Format("VK{:X}",A_Index))?"{" Key " up}":
Return

Post Reply

Return to “Ask for Help (v1)”