Created
May 28, 2023 03:29
-
-
Save anthonybaldwin/6cb1d23421447230d738a7c0306775af to your computer and use it in GitHub Desktop.
AHK v2 Script to Disable Office/Hyper Key Shortcuts on Windows 11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Original: https://web.archive.org/web/20230528022520/https://www.howtogeek.com/445318/how-to-remap-the-office-key-on-your-keyboard/ | |
; Converted using: https://github.com/mmikeww/AHK-v2-script-converter | |
; Registry fix: | |
; Add: REG ADD HKCU\Software\Classes\ms-officeapp\Shell\Open\Command /t REG_SZ /d rundll32 | |
; Remove: REG DELETE HKCU\Software\Classes\ms-officeapp\Shell | |
; To use: | |
; - Run the registry ADD fix above via Administrator PowerShell | |
; - Run this script on StartUp (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp) by: | |
; - Compiling to an executable using Ahk2Exe and placing in StartUp | |
; - Alternatively, by adding a batch file in StartUp: | |
; - Start "" "C:\Users\Your Name\Documents\AutoHotkey\Disable Office Keys.ahk" | |
; - Optional: Remove comments allowing the emoji picker below | |
; And while the preferred method (minus a Microsoft fix...), I cannot use OfficeKeyFix on startup due to conflicts w/ the Explorer restart. | |
; - https://github.com/anthonyheddings/OfficeKeyFix / https://github.com/stringlapse/OfficeKeyFix | |
SetWorkingDir(A_ScriptDir) | |
#UseHook | |
InstallKeybdHook() | |
#SingleInstance force | |
SendMode("Input") | |
#^!+D:: ; Disables OneDrive shortcut | |
{ | |
Send("^!+D") | |
return | |
} | |
#^!+L:: ; Disables LinkedIn shortcut | |
{ | |
Send("^!+L") | |
return | |
} | |
#^!+N:: ; Disables OneNote shortcut | |
{ | |
Send("^!+N") | |
return | |
} | |
#^!+O:: ; Disables Mail shortcut | |
{ | |
Send("^!+O") | |
return | |
} | |
#^!+P:: ; Disables PowerPoint shortcut | |
{ | |
Send("^!+P") | |
return | |
} | |
#^!+T:: ; Disables Teams shortcut | |
{ | |
Send("^!+T") | |
return | |
} | |
#^!+W:: ; Disables Word shortcut | |
{ | |
Send("^!+W") | |
return | |
} | |
#^!+X:: ; Disables Excel shortcut | |
{ | |
Send("^!+X") | |
return | |
} | |
#^!+Y:: ; Disables Yammer shortcut | |
{ | |
Send("^!+Y") | |
return | |
} | |
; #^!+Space:: ; Disables emoji picker | |
; { | |
; Send("^!+Space") | |
; return | |
; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Start "" "C:\Users\Your Name\Documents\AutoHotkey\Disable Office Keys.ahk" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment