this post was submitted on 27 Apr 2024
10 points (85.7% liked)

techsupport

2468 readers
9 users here now

The Lemmy community will help you with your tech problems and questions about anything here. Do not be shy, we will try to help you.

If something works or if you find a solution to your problem let us know it will be greatly apreciated.

Rules: instance rules + stay on topic

Partnered communities:

You Should Know

Reddit

Software gore

Recommendations

founded 1 year ago
MODERATORS
 

At work I have a Windows PC. I don't have much personal experience with Windows which is why I am asking.

I want to remap the caps lock key to function as a control key. Ideally, on a per-user basis as sometimes other people use the workstation and I don't want to confuse them.

  • Was able to install Auto Hot Key. A test script worked. However I couldn't find working instructions about how to do this specific remapping. Example scripts I found seem to have some conflict between v1 and v2 of AH.

  • I don't have admin access however I could probably ask for something, but it would have to work immediately without a lot of fooling around. I will not be granted admin access to try a bunch of things til I find something that works.

What's the best way?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 6 months ago* (last edited 6 months ago) (1 children)

Okay, so make a script, name it whatever you feel like and paste this:

; The keyboard hook must be installed.
InstallKeybdHook
SendSuppressedKeyUp(key) {
    DllCall("keybd_event"
        , "char", GetKeyVK(key)
        , "char", GetKeySC(key)
        , "uint", KEYEVENTF_KEYUP := 0x2
        , "uptr", KEY_BLOCK_THIS := 0xFFC3D450)
}

; Disable Alt+key shortcuts for the IME.
~LAlt::SendSuppressedKeyUp "LAlt"

; Test hotkey:
!CapsLock::MsgBox A_ThisHotkey

; Remap CapsLock to LCtrl in a way compatible with IME.
*CapsLock::
{
    Send "{Blind}{LCtrl DownR}"
    SendSuppressedKeyUp "LCtrl"
}
*CapsLock up::
{
    Send "{Blind}{LCtrl Up}"
} 

Save it, run it and you should be good to go.

edit: This is V2, just in case.

[–] [email protected] 1 points 6 months ago (1 children)

Thanks I will do this!

Does this first line mean anything? I didn't install anything except the basic AH package:

;The keyboard hook must be installed.
[–] [email protected] 2 points 6 months ago (1 children)

It is just a comment for the InstallKeybdHook command just bellow it, as it is crucial for this magical code (that I don’t fully grasp yet) to work.

But it does.

[–] [email protected] 1 points 6 months ago

ah OK thanks!

I will try this when I am at my workstation.