Disabling CapsLock's original SetCapsLockState function

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ABUSHIHAB
Posts: 8
Joined: 29 Nov 2021, 12:10

Disabling CapsLock's original SetCapsLockState function

Post by ABUSHIHAB » 29 Nov 2021, 12:19

I want a simple line of code that removes the original function of the CapsLock key because I want to use it like an additional function key (similar to ctrl and alt for example.) I could say

Code: Select all

CapsLock::return
but that would completely disable the key itself (and doesn't work when the key is held down for some reason). Thanks.

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: Disabling CapsLock's original SetCapsLockState function

Post by mikeyww » 29 Nov 2021, 15:08

So set it to something else!

Code: Select all

CapsLock::Ctrl
Welcome to AHK. :)

ABUSHIHAB
Posts: 8
Joined: 29 Nov 2021, 12:10

Re: Disabling CapsLock's original SetCapsLockState function

Post by ABUSHIHAB » 29 Nov 2021, 20:56

mikeyww wrote:
29 Nov 2021, 15:08
So set it to something else!

Code: Select all

CapsLock::Ctrl
But wouldn't that ruin the key? "CapsLock & c" for example would become indistinguishable from "^c".

ABUSHIHAB
Posts: 8
Joined: 29 Nov 2021, 12:10

Re: Disabling CapsLock's original SetCapsLockState function

Post by ABUSHIHAB » 29 Nov 2021, 21:05

So, I've had a realization and another question:
If I say

Code: Select all

CapsLock::{F13}
Should my subsequent code go like:

Code: Select all

{F13} & c::SoundBeep
Or

Code: Select all

CapsLock & c::Soundbeep
?

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: Disabling CapsLock's original SetCapsLockState function

Post by mikeyww » 29 Nov 2021, 21:51

I am thinking that you have not yet decided what you want your final script to do. When ready, you can post a description of all of the intended effects.

lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: Disabling CapsLock's original SetCapsLockState function

Post by lexikos » 30 Nov 2021, 02:58

ABUSHIHAB wrote:but that would completely disable the key itself
No. What gave you that idea?

Just use CapsLock::return in combination with CapsLock & c::.

If you might be holding Ctrl, Alt, Shift or Win when you press CapsLock, use *CapsLock::return instead (just add *). Leave it off if you want to be able to toggle CapsLock (by using it in combination with Ctrl, Alt, Shift or Win).

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: Disabling CapsLock's original SetCapsLockState function

Post by mikeyww » 30 Nov 2021, 07:39

I guess I misunderstood. Sorry about that!

Post Reply

Return to “Ask for Help (v1)”