Skip to content

Instantly share code, notes, and snippets.

@joonhwan
Created January 5, 2021 01:43
Show Gist options
  • Save joonhwan/fd306375884a1b6ec31230850f436543 to your computer and use it in GitHub Desktop.
Save joonhwan/fd306375884a1b6ec31230850f436543 to your computer and use it in GitHub Desktop.
윈도우즈 HHKB 사용시 사용하면 편리한 authokey
#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.
;; 한자키 설정({vk19sc1F1})
Rwin::Send, {VK19} ; {vk19sc1F1}
;; 한글키 설정
RAlt::Send, {VK15} ;{vk15sc138}
;;
;; ESC를 누르면 자동으로 영문전환
;;
#IfWinActive ahk_exe cmd.exe
$ESC::
#IfWinActive ahk_exe WindowsTerminal.exe
$Esc::
if(IME_CHECK("A"))
Send, {VK15} ;영문이라면 한영전환 키를 입력해준다.
Send, {Escape}
return
; #IfWinActive("ahk_exe cmd.exe"))
/*
IME check
*/
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)
}
;; 아래는 예전에 사용하던 것.
; HHKB FN Key 때문에 넣은 것. Function Key의 경우에는
; 그냥 HHKB의 WIN키를 FN로 쓰도록 한다.
; #2::F2
; #3::F3
; #4::F4
; #5::F5
; #6::F6
; #7::F7
; #8::F8
; #9::F9
; #0::F10
; #-::F11
; #=::F12
;; ALT or CTRL+4 --> ALT or CTRL+F4
; ^4::Send ^{F4}
;; WIN를 사용한 화살표 키 -_-
;; #[::Send {Up}
;; #;::Send {Left}
;; #/::Send {Down}
;; #'::Send {Right}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment