Skip to content

Instantly share code, notes, and snippets.

@c0ze
Created December 13, 2025 18:07
Show Gist options
  • Select an option

  • Save c0ze/42b7f29fe97f7004cbc9b9d8b818091f to your computer and use it in GitHub Desktop.

Select an option

Save c0ze/42b7f29fe97f7004cbc9b9d8b818091f to your computer and use it in GitHub Desktop.
Autohotkeys script to map henkan keys for Windows
#Requires AutoHotkey v2.0
; The Trinity: G913 Windows Edition (v5 Stable)
DetectHiddenWindows True
; -----------------------------------------------------------
; Scancode Map for G913 JIS:
; SC07B = Muhenkan (Left of Space)
; SC079 = Henkan (Right of Space)
; SC070 = Katakana/Hiragana (Far Right)
; -----------------------------------------------------------
; Muhenkan -> English (US Hybrid)
SC07B::
{
SoundBeep(1000, 100) ; Beep FIRST
PostMessage(0x50, 0, 0x4110409, , "A")
}
; Henkan -> Japanese (Hiragana Enforcer)
SC079::
{
SoundBeep(1500, 100) ; Beep FIRST to confirm key press
; 1. Switch Language
PostMessage(0x50, 0, 0x04110411, , "A")
Sleep(100) ; Increased wait time slightly for stability
; 2. Attempt to Force Hiragana (Wrapped in Try to prevent crashes)
try {
IME_ForceHiragana()
}
}
; Katakana -> Turkish (Q)
SC070::
{
SoundBeep(800, 100) ; Beep FIRST
PostMessage(0x50, 0, 0x041F041F, , "A")
}
; -----------------------------------------------------------
; IME FUNCTIONS
; -----------------------------------------------------------
IME_ForceHiragana() {
hWnd := WinActive("A")
if !hWnd
return
; Get Default IME Window
hIME := DllCall("imm32\ImmGetDefaultIMEWnd", "Ptr", hWnd, "Ptr")
if !hIME
return
; Force IME ON (Open)
; 0x0283 = WM_IME_CONTROL
; 0x006 = IMC_SETOPENSTATUS
DllCall("SendMessage", "Ptr", hIME, "UInt", 0x0283, "Ptr", 0x006, "Ptr", 1)
; Force Conversion Mode to Hiragana
; 0x002 = IMC_SETCONVERSIONMODE
; 0x009 = FullShape (8) + Native (1)
DllCall("SendMessage", "Ptr", hIME, "UInt", 0x0283, "Ptr", 0x002, "Ptr", 0x009)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment