打开 Mac 的自动操作,添加 AppleScript 脚本,脚本内容为:
-- 弹出对话框,获取第一个输入文本
set out to (display dialog "请输入结果文本:" default answer "")'s text returned
-- 弹出对话框,获取第二个输入文本
set input to (display dialog "请输入简码:" default answer "")'s text returned
-- 拼接两个文本加上制表符,生成 custom 字符串
set custom to out & (character id 9) & input
-- 使用 shell 通过 echo 将 custom 字符串追加到 custom_phrase.txt 文件末尾
do shell script "echo " & quoted form of custom & " >> /Users/{YOUR NAME}/Library/Rime/custom_phrase.txt"
-- 模拟按键操作重新部署
tell application "System Events"
keystroke "`" using {control down, option down}
end tell
然后将脚本保存为工作流,或者服务(可以通过全局快捷键调用),或者应用程序( Quick Add RIME Custom 简称 qarc ),通过 HapiGo 或者 Alfred 或者 Raycast 调用,这样就可以不用离开键盘完成这些操作了。
注: