Last active
September 11, 2021 16:07
-
-
Save komamitsu/54ccdf681d2bdda1b47f9bbd1164e2fb to your computer and use it in GitHub Desktop.
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
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
; ^M | |
^M::Enter | |
; ^H | |
^H::BackSpace | |
; Muhenkan | |
SC07B::Ctrl | |
; Henkan | |
SC079::Esc | |
; Katakana/Hiragana | |
SC070:: | |
currentIMEMode := IME_Get() | |
if (%currentIMEMode% = 0) | |
{ | |
IME_SET(1) | |
} | |
else | |
{ | |
IME_SET(0) | |
} | |
return | |
; Helper functions | |
; Author: eamat | |
; URL: http://www6.atwiki.jp/eamat/ | |
IME_GET(WinTitle="A") { | |
ControlGet,hwnd,HWND,,,%WinTitle% | |
if (WinActive(WinTitle)) { | |
ptrSize := !A_PtrSize ? 4 : A_PtrSize | |
VarSetCapacity(stGTI, cbSize:=4+4+(PtrSize*6)+16, 0) | |
NumPut(cbSize, stGTI, 0, "UInt") ; DWORD cbSize; | |
hwnd := DllCall("GetGUIThreadInfo", Uint,0, Uint,&stGTI) | |
? NumGet(stGTI,8+PtrSize,"UInt") : hwnd | |
} | |
return DllCall("SendMessage" | |
, UInt, DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hwnd) | |
, UInt, 0x0283 ;Message : WM_IME_CONTROL | |
, Int, 0x0005 ;wParam : IMC_GETOPENSTATUS | |
, Int, 0) ;lParam : 0 | |
} | |
; Author: eamat | |
; URL: http://www6.atwiki.jp/eamat/ | |
IME_SET(SetSts, WinTitle="A") { | |
ControlGet,hwnd,HWND,,,%WinTitle% | |
if (WinActive(WinTitle)) { | |
ptrSize := !A_PtrSize ? 4 : A_PtrSize | |
VarSetCapacity(stGTI, cbSize:=4+4+(PtrSize*6)+16, 0) | |
NumPut(cbSize, stGTI, 0, "UInt") ; DWORD cbSize; | |
hwnd := DllCall("GetGUIThreadInfo", Uint,0, Uint,&stGTI) | |
? NumGet(stGTI,8+PtrSize,"UInt") : hwnd | |
} | |
return DllCall("SendMessage" | |
, UInt, DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hwnd) | |
, UInt, 0x0283 ;Message : WM_IME_CONTROL | |
, Int, 0x006 ;wParam : IMC_SETOPENSTATUS | |
, Int, SetSts) ;lParam : 0 or 1 | |
} |
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
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
LAlt::LCtrl | |
LWin::LAlt | |
LCtrl::LWin | |
RAlt::Esc | |
; ^M | |
^M::Enter | |
; ^H | |
^H::BackSpace | |
; Katakana/Hiragana | |
RCtrl:: | |
currentIMEMode := IME_Get() | |
if (%currentIMEMode% = 0) | |
{ | |
IME_SET(1) | |
} | |
else | |
{ | |
IME_SET(0) | |
} | |
return | |
; Helper functions | |
; Author: eamat | |
; URL: http://www6.atwiki.jp/eamat/ | |
IME_GET(WinTitle="A") { | |
ControlGet,hwnd,HWND,,,%WinTitle% | |
if (WinActive(WinTitle)) { | |
ptrSize := !A_PtrSize ? 4 : A_PtrSize | |
VarSetCapacity(stGTI, cbSize:=4+4+(PtrSize*6)+16, 0) | |
NumPut(cbSize, stGTI, 0, "UInt") ; DWORD cbSize; | |
hwnd := DllCall("GetGUIThreadInfo", Uint,0, Uint,&stGTI) | |
? NumGet(stGTI,8+PtrSize,"UInt") : hwnd | |
} | |
return DllCall("SendMessage" | |
, UInt, DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hwnd) | |
, UInt, 0x0283 ;Message : WM_IME_CONTROL | |
, Int, 0x0005 ;wParam : IMC_GETOPENSTATUS | |
, Int, 0) ;lParam : 0 | |
} | |
; Author: eamat | |
; URL: http://www6.atwiki.jp/eamat/ | |
IME_SET(SetSts, WinTitle="A") { | |
ControlGet,hwnd,HWND,,,%WinTitle% | |
if (WinActive(WinTitle)) { | |
ptrSize := !A_PtrSize ? 4 : A_PtrSize | |
VarSetCapacity(stGTI, cbSize:=4+4+(PtrSize*6)+16, 0) | |
NumPut(cbSize, stGTI, 0, "UInt") ; DWORD cbSize; | |
hwnd := DllCall("GetGUIThreadInfo", Uint,0, Uint,&stGTI) | |
? NumGet(stGTI,8+PtrSize,"UInt") : hwnd | |
} | |
return DllCall("SendMessage" | |
, UInt, DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hwnd) | |
, UInt, 0x0283 ;Message : WM_IME_CONTROL | |
, Int, 0x006 ;wParam : IMC_SETOPENSTATUS | |
, Int, SetSts) ;lParam : 0 or 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment