Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save KudoLayton/27a053f1a01e24d8f86b7907c67ae5b8 to your computer and use it in GitHub Desktop.
Save KudoLayton/27a053f1a01e24d8f86b7907c67ae5b8 to your computer and use it in GitHub Desktop.
IME_CHECK(WinTitle)
{
WinGet,hWnd,ID,%WinTitle%
Return Send_ImeControl(ImmGetDefaultIMEWnd(hWnd),0x005,"")
}
Send_ImeControl(DefaultIMEWnd, wParam, lParam)
{
DetectSave := A_DetectHiddenWindows
DetectHiddenWindows,ON
SendMessage 0x283, wParam,lParam,,ahk_id %DefaultIMEWnd%
if (DetectSave <> A_DetectHiddenWindows)
DetectHiddenWindows,%DetectSave%
return ErrorLevel
}
ImmGetDefaultIMEWnd(hWnd)
{
return DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hWnd, Uint)
}
Esc::
WinGetActiveTitle, ExplorerTitle
ime_status := % IME_CHECK("A")
if (ime_status="0")
{
} else {
Send, {vk15sc138}
}
HotKey, ESC, Off
Send {Esc}
HotKey, ESC, On
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment