Skip to content

Instantly share code, notes, and snippets.

@yoshiko-pg
Created May 6, 2014 13:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save yoshiko-pg/5a6a069bf0be0074c0af to your computer and use it in GitHub Desktop.
Save yoshiko-pg/5a6a069bf0be0074c0af to your computer and use it in GitHub Desktop.
AutoHotkeyの設定。 日本語が混ざるとエラーになる
; colon & semicolon swap
$vkBAsc027::Send, :
+$vkBAsc027::Send, `;
; Alt -> IME
LAlt::IME_SET(0)
LWin::IME_SET(0)
RAlt::IME_SET(1)
; iTunes
RShift & Space::Send, {Media_Play_Pause}
RShift & Left::Send, {Media_Prev}
RShift & Right::Send, {Media_Next}
; PC Sleep
; http://retla.g.hatena.ne.jp/retla/20100930/1285808219
RShift & Delete::DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
; IME util
; http://blog.ayakix.com/2009/12/imeon-offautohotkey.html
IME_GET(WinTitle="")
{
ifEqual WinTitle,, SetEnv,WinTitle,A
WinGet,hWnd,ID,%WinTitle%
DefaultIMEWnd := DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hWnd, Uint)
;Message : WM_IME_CONTROL wParam:IMC_GETOPENSTATUS
DetectSave := A_DetectHiddenWindows
DetectHiddenWindows,ON
SendMessage 0x283, 0x005,0,,ahk_id %DefaultIMEWnd%
DetectHiddenWindows,%DetectSave%
Return ErrorLevel
}
IME_SET(setSts, WinTitle="")
{
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
}
IME_GetConvMode(WinTitle="")
{
ifEqual WinTitle,, SetEnv,WinTitle,A
WinGet,hWnd,ID,%WinTitle%
DefaultIMEWnd := DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hWnd, Uint)
;Message : WM_IME_CONTROL wParam:IMC_GETCONVERSIONMODE
DetectSave := A_DetectHiddenWindows
DetectHiddenWindows,ON
SendMessage 0x283, 0x001,0,,ahk_id %DefaultIMEWnd%
DetectHiddenWindows,%DetectSave%
Return ErrorLevel
}
IME_SetConvMode(ConvMode,WinTitle="")
{
ifEqual WinTitle,, SetEnv,WinTitle,A
WinGet,hWnd,ID,%WinTitle%
DefaultIMEWnd := DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hWnd, Uint)
;Message : WM_IME_CONTROL wParam:IMC_SETCONVERSIONMODE
DetectSave := A_DetectHiddenWindows
DetectHiddenWindows,ON
SendMessage 0x283, 0x002,ConvMode,,ahk_id %DefaultIMEWnd%
DetectHiddenWindows,%DetectSave%
Return ErrorLevel
}
IME_GetSentenceMode(WinTitle="")
{
ifEqual WinTitle,, SetEnv,WinTitle,A
WinGet,hWnd,ID,%WinTitle%
DefaultIMEWnd := DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hWnd, Uint)
;Message : WM_IME_CONTROL wParam:IMC_GETSENTENCEMODE
DetectSave := A_DetectHiddenWindows
DetectHiddenWindows,ON
SendMessage 0x283, 0x003,0,,ahk_id %DefaultIMEWnd%
DetectHiddenWindows,%DetectSave%
Return ErrorLevel
}
IME_SetSentenceMode(SentenceMode,WinTitle="")
{
ifEqual WinTitle,, SetEnv,WinTitle,A
WinGet,hWnd,ID,%WinTitle%
DefaultIMEWnd := DllCall("imm32\ImmGetDefaultIMEWnd", Uint,hWnd, Uint)
;Message : WM_IME_CONTROL wParam:IMC_SETSENTENCEMODE
DetectSave := A_DetectHiddenWindows
DetectHiddenWindows,ON
SendMessage 0x283, 0x004,SentenceMode,,ahk_id %DefaultIMEWnd%
DetectHiddenWindows,%DetectSave%
Return ErrorLevel
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment