Last active
January 21, 2020 07:19
-
-
Save Jessidhia/4b5610a47476e0d8a913 to your computer and use it in GitHub Desktop.
Script to enable JIS keys on Windows Dvorak layout
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
#SingleInstance force | |
#InstallKeybdHook | |
#UseHook On | |
; HACK: KBDDV.DLL doesn't deal with the IME keys, so map them by scancode | |
; Yen key: 07d, assign to \ :( | |
; Backslash key: 073, assign to ` | |
; Hankaku/Zenkaku key: working as tilde key, don't touch | |
; Muhenkan: 07B, disable IME | |
; Henkan: 079, enable IME | |
; Katakana/Hiragana: 070, assign to RWin | |
SC07d::\ | |
SC073::` | |
SC070::RWin | |
; Library to enable/disable IME | |
IME_SET(setSts, WinTitle="") | |
;----------------------------------------------------------- | |
; IMEの状態をセット | |
; 対象: AHK v1.0.34以降 | |
; SetSts : 1:ON 0:OFF | |
; WinTitle: 対象Window (省略時:アクティブウィンドウ) | |
; 戻り値 1:ON 0:OFF | |
;----------------------------------------------------------- | |
{ | |
ifEqual WinTitle,, SetEnv,WinTitle,A | |
WinGet,hWnd,ID,%WinTitle% | |
DefaultIMEWnd := DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hWnd, Uint) | |
;Message : WM_IME_CONTROL wParam:IMC_SETOPENSTATUS | |
DetectSave := A_DetectHiddenWindows | |
DetectHiddenWindows,ON | |
SendMessage 0x283, 0x006,setSts,,ahk_id %DefaultIMEWnd% | |
DetectHiddenWindows,%DetectSave% | |
Return ErrorLevel | |
} | |
SC07b::IME_SET(0) | |
SC079::IME_SET(1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
IME_SET
does not work on Modern applications :(