InputManager.frameworkを呼び出して、日本語入力Input Methodの入力文字の切り替えを行うAppleScriptです。
スクリプトエディタ上でControl-Command-Rにてフロントエンド・プロセスで実行する必要があります。
AppleScript名:InputManagerでIMを切り換える |
— Created 2017-01-22 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" use framework "InputManager" –https://github.com/jensnockert/input-manager –Check If this script runs in foreground if not (current application’s NSThread’s isMainThread()) as boolean then display alert "This script must be run from the main thread (Command-Control-R in Script Editor)." buttons {"Cancel"} as critical error number -128 end if –Caution: This script runs on only Japanese language environment set cList to current application’s CSInputSource’s all() set dList to (cList’s valueForKey:"localizedName") set aRes to ((dList’s indexOfObject:"ひらがな") as integer) –"Hiragana" in Japanese set bRes to ((dList’s indexOfObject:"英字") as integer) –"English Letters" in Japanese set hiraKey to cList’s objectAtIndex:aRes set engKey to cList’s objectAtIndex:bRes repeat 10 times hiraKey’s |select|() delay 1 engKey’s |select|() delay 1 end repeat |
More from my site
(Visited 58 times, 1 visits today)