메인 콘텐츠로 건너뛰기

오토핫키 Numpad 키 매핑 문제 (AutoHotkey Numpad Key Mapping Issue)

요약

문제 상황:

  • 오토핫키를 이용해 넘패드 0 키에 End 키를 매핑하려고 스크립트 작성.

  • 단독으로 넘패드 0을 눌렀을 때는 End 키가 정상 작동.

  • Shift + 넘패드 0을 눌렀을 때, 예상되는 Shift + End 대신 Insert 키가 동작하는 문제 발생.

원인 분석:

  • 오토핫키 키 히스토리 기능(트레이 아이콘 우클릭 -> Open -> View -> Key history and script info)을 통해 입력 키 확인.

  • Shift + 넘패드 0 조합이 NumpadIns로 인식되는 것을 확인. (넘패드 키는 Shift 키와 함께 눌릴 때 다른 키로 동작하는 경우가 있음)

해결 방법:

  • Shift 조합으로 텍스트를 선택한 후 화살표 키로 이동할 때 Shift 상태가 풀리는 것을 방지하기 위해 {Blind} 키워드 사용.

  • NumpadIns 키에 대한 매핑을 추가하여 Shift + Numpad0Shift + End로 동작하도록 처리.

스크립트 변경 내용:

; 기존 ahk

$Numpad2::Home

$Numpad0::End

; 변경 ahk

$Numpad2::Home

$NumpadDown::Send '{Blind}{Home}'

$Numpad0::End

$NumpadIns::Send '{Blind}{End}'


Issue Description:

  • Attempted to map the Numpad 0 key to the End key using an AutoHotkey script.

  • Pressing Numpad 0 alone correctly triggered End.

  • However, pressing Shift + Numpad 0 unexpectedly triggered the Insert key instead of the desired Shift + End.

Cause Analysis:

  • The AutoHotkey Key History feature (Right-click tray icon -> Open -> View -> Key history and script info) was used to inspect the input.

  • It was confirmed that the Shift + Numpad 0 combination was being recognized as NumpadIns. (Numpad keys often have dual functions, and Numpad 0 typically becomes NumpadIns when Shift is held, or NumLock is off).

Solution Implemented:

  • Added the {Blind} keyword to prevent the Shift state from being released when selecting text and moving with arrow keys.

  • Added a separate hotkey for NumpadIns to ensure that Shift + Numpad 0 correctly performs Shift + End.

Script Changes:

; Original ahk

$Numpad2::Home

$Numpad0::End

; Updated ahk

$Numpad2::Home

$NumpadDown::Send '{Blind}{Home}'

$Numpad0::End

$NumpadIns::Send '{Blind}{End}'