键盘C/Q键损坏的AutoHotkey脚本修复及功能适配咨询
AutoHotkey Script Solution for Broken C/Q Keys
Got it, let's fix this step by step. Your original script had gaps with modifier key handling and conflicting hotkeys, so here's a complete solution that covers all your requirements:
; 1. Right Ctrl + S/K to send C/Q (supports Shift/CapsLock) #If GetKeyState("RCtrl", "P") && !GetKeyState("LCtrl", "P") >^s::Send {Blind}c >^k::Send {Blind}q #If ; 2. Left Ctrl + Right Ctrl + S to trigger Ctrl+C (copy) <^>^s::SendInput ^c
Breakdown of How This Works:
#If GetKeyState("RCtrl", "P") && !GetKeyState("LCtrl", "P"): This directive restricts the following hotkeys to activate only when Right Ctrl is pressed and Left Ctrl is not. This eliminates interference with your Left Ctrl+S/K shortcuts (like Ctrl+Save or Ctrl+Close tab) — they’ll work exactly as normal now.>^s::Send {Blind}c/>^k::Send {Blind}q:>^explicitly targets the Right Ctrl modifier.- The
{Blind}parameter preserves the state of other modifiers (Shift, CapsLock):- Press
Right Ctrl + Shift + S→ outputs uppercase C - Press
Right Ctrl + Swith CapsLock on → outputs uppercase C - Normal
Right Ctrl + S→ outputs lowercase C, matching your original need.
- Press
<^>^s::SendInput ^c: This hotkey triggers when both Left and Right Ctrl are held plus S, sending the standard Ctrl+C copy command.SendInputensures fast, reliable execution.
Quick Test Checklist:
- Save this as a
.ahkfile and run it with AutoHotkey. - Verify all cases work:
Right Ctrl + S→ outputs C (case respects Shift/CapsLock)Right Ctrl + K→ outputs Q (case respects Shift/CapsLock)Left Ctrl + S→ triggers normal Ctrl+SaveLeft Ctrl + K→ triggers normal Ctrl+K (e.g., close browser tab)Left Ctrl + Right Ctrl + S→ triggers Ctrl+Copy- All other Left Ctrl combinations (Ctrl+A, Ctrl+V, etc.) stay functional
内容的提问来源于stack exchange,提问作者Xwtek
相关产品推荐
相关产品推荐

