Last active
February 7, 2025 21:58
-
-
Save atty303/14c7d4b23bc27d7549d1cd8aa6e5c040 to your computer and use it in GitHub Desktop.
キーが単独で押されたときコールバックを実行する
This file contains hidden or 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
InstallKeybdHook | |
;;; キーが単独で押されたときコールバックを実行する | |
StandaloneHotKey(key, callback) { | |
static enabled := false | |
down() { | |
enabled := true | |
; https://github.com/karakaram/alt-ime-ahk/issues/2 | |
Send("{Blind}{vk07}") | |
} | |
up() { | |
if enabled { | |
enabled := false | |
If A_PriorKey = key { | |
callback() | |
} | |
} | |
} | |
Hotkey("~" . key, _ => down()) | |
Hotkey(key . " Up", _ => up()) | |
standaloneHook := InputHook("L0V") | |
standaloneHook.NotifyNonText := true | |
standaloneHook.OnKeyDown := (hook, vk, sc) => enabled := false | |
standaloneHook.Start() | |
} | |
StandaloneHotKey("LAlt", () => Send("{vk1D}")) ; LAlt単独 -> 無変換 | |
StandaloneHotKey("RAlt", () => Send("{vk1C}")) ; RAlt単独 -> 変換 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alt単独を無変換・変換に割り当て、ATOK側で無変換・変換にON/OFFを割り当てている。
Ref: WindowsのATOKで日本語入力のON/OFFを変換/無変換キーに割り当てる