Keep capslock always off

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
inoperable
Posts: 10
Joined: 16 Nov 2019, 10:30

Keep capslock always off

Post by inoperable » 16 Nov 2019, 12:56

Hello everyone,

I ported some parts from Capslock script by Vonng (source: https://github.com/Vonng/Capslock/blob/master/win/CapsLock.ahk)
Only thing that is not working as I'd like it to work is to set capslock to Off after any kind of capslock combination.
I don't need capslock functionality of any kind, it only annoys me, however its stays on when combined with some keys
but not with another - I cant figure this out.

Code: Select all

SetCapsLockState(AlwaysOff)
* & Up::
  	SetCapsLockState(Off)
...

Code: Select all

*$CapsLock:: 
	Send("{ESC}")
  	SetCapsLockState(Off)
	Return
I added the code above, this works partially (and I dont know why)
Modifieres wont toggle capslock, but capslock + ] will,

I tried to add the SetCapsLockState(Off) function to all capslock mappings
within the script, but this does not work either.

Is there a simple way to execute SetCapsLockState(off) after EVERY key send
as last action of the script?

Whole script: https pastebin.com /bukK5Sby Broken Link for safety

inoperable
Posts: 10
Joined: 16 Nov 2019, 10:30

Re: Keep capslock always off

Post by inoperable » 16 Nov 2019, 13:08

UPDATE: The first quoted code block is obviously wrong - I quoted it so to make it easier to understand what
I mean. I would like to execute

Code: Select all

SetCapsLockState(Off)
every time Capslock KeyUp is fired, whenver AnyKey + Capslock or just Capslock alone KeyUp
is propagating.

Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Keep capslock always off

Post by Helgef » 16 Nov 2019, 13:24

Hi, SetCapsLockState('AlwaysOff')

Cheers.

inoperable
Posts: 10
Joined: 16 Nov 2019, 10:30

Re: Keep capslock always off

Post by inoperable » 16 Nov 2019, 13:27

Damnit :-) that's seems to be the problem. Thanks!

inoperable
Posts: 10
Joined: 16 Nov 2019, 10:30

Re: Keep capslock always off

Post by inoperable » 16 Nov 2019, 13:35

Hmmm.. the above works, but after a few minutes capslock can be toggled again...
@Helgef: Could you please point me where/when/how execute the function to have
that problem solved?

Gramercy

inoperable
Posts: 10
Joined: 16 Nov 2019, 10:30

Re: Keep capslock always off

Post by inoperable » 16 Nov 2019, 14:18

Well, I think I solved it by adding on the top of the script, although I'm not sure if
that's the way to do it.

Code: Select all

~*CapsLock::
	SetCapsLockState("AlwaysOff")

Post Reply

Return to “Ask for Help (v2)”