Require CAP LOCK press for 2 seconds

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
borgunit
Posts: 1
Joined: 23 May 2018, 09:20

Require CAP LOCK press for 2 seconds

23 May 2018, 09:26

I am looking for a way to have the CAP LOCK key be pressed for 2 seconds before it is activated.

Has this been done before?

Thanks
Qysh
Posts: 143
Joined: 24 Apr 2018, 09:16

Re: Require CAP LOCK press for 2 seconds

24 May 2018, 14:54

I hope this helps ;)

Code: Select all

caps_delay := 2 ; seconds

;-------------------

SetCapsLockState, Off
capsState := false
caps_delay := caps_delay * 250

CapsLock::
Loop, 4
{
	if(!GetKeyState("CapsLock", "p"))
	{
		return
	}
	Sleep, %caps_delay%
}
if(capsState)
{
	SetCapsLockState, Off
	capsState := false
}
else
{
	SetCapsLockState, On
	capsState := true
}
return
gregster
Posts: 9015
Joined: 30 Sep 2013, 06:48

Re: Require CAP LOCK press for 2 seconds

24 May 2018, 16:51

Please use the Ask for Help forum next time!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 221 guests