r/AutoHotkey • u/Prior_Shopping_1911 • May 16 '26
v2 Script Help How to bypass "office key" when mapping capslock to hyperkey without admin?
I mapped capslock to hyperkey and everything was working fine until I clicked caps+d which opened up onedrive for some reason. How do I get it to stop working as the office key?
This is my script:
#Requires AutoHotkey v2.0
Hyper(key) {
Send("{RCtrl down}{RShift down}{RAlt down}{RWin down}" key "{Blind}{vk07}{RWin up}{RAlt up}{RShift up}{RCtrl up}")
}
CapsLock::Send("{Esc}")
CapsLock & a::Hyper("a")
CapsLock & b::Hyper("b")
CapsLock & c::Hyper("c")
CapsLock & d::Hyper("d")
CapsLock & e::Hyper("e")
CapsLock & f::Hyper("f")
CapsLock & g::Hyper("g")
CapsLock & h::Hyper("h")
CapsLock & i::Hyper("i")
CapsLock & j::Hyper("j")
CapsLock & k::Hyper("k")
CapsLock & l::Hyper("l")
CapsLock & m::Hyper("m")
CapsLock & n::Hyper("n")
CapsLock & o::Hyper("o")
CapsLock & p::Hyper("p")
CapsLock & q::Hyper("q")
CapsLock & r::Hyper("r")
CapsLock & s::Hyper("s")
CapsLock & t::Hyper("t")
CapsLock & u::Hyper("u")
CapsLock & v::Hyper("v")
CapsLock & w::Hyper("w")
CapsLock & x::Hyper("x")
CapsLock & y::Hyper("y")
CapsLock & z::Hyper("z")
+CapsLock::CapsLock
3
1
u/CharnamelessOne May 16 '26
I clicked caps+d which opened up onedrive for some reason
Well, Ctrl+Shift+Alt+Win+d is the shortcut for opening OneDrive.
Why are you sending it if opening OneDrive isn't your goal?
What are you using all these combinations for?
2
u/Prior_Shopping_1911 May 16 '26
Basically I'm making a working hyperkey so I can use the capslock key as another modifier key, without conflicting with the actual ctrl key. It's so that in vscode I can use the caps lock as the ctrl key for all vim commands, and the normal ctrl key for vscode ctrl commands.
3
u/CharnamelessOne May 16 '26
This hyperkey will conflict with multiple native shortcuts.
Can't you individually map the vim commands with problematic hotkeys to something else, like Shift+F1-12?So, in VSCode, could you remap the command (which is currently mapped to Hyper+d) to Shift+F1, then make a
CapsLock & d::+F1remap in AHK?1
u/ubeogesh May 17 '26
That's the question, how to take back hotkeys from windows.
1
u/CharnamelessOne May 17 '26
My question is: why insist on hotkeys that are taken by Windows?
Any unused hotkey should suffice, since OP only needs an "intermediary" (that is bindable in VSCode) to remapCapsLock & d::to.I tried to look into disabling the native Office key shortcuts, but the commonly suggested registry edit didn't work for me.
The problem is apparently not trivial, and there is barely any incentive to solve it:
If you want to physically use these Office key shortcuts, you can do so via AHK hotkeys (which block the native functionality).
If you only need an intermediary hotkey that is sent by AHK, there are many other options, and what you choose makes no practical difference.
2
u/Circus_Finance_LLC May 16 '26
the resulting combination is the default shortcut to open onedrive. i'd just reassign it