两个 AppleScript 文件,弄了好久一直是一开始几次窗口能够自动前置,可是后来却不会前置了,终于弄好分享下 一个是 Emacs Client.app 的:
try
set frameVisible to do shell script "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -e '(<= 2 (length (visible-frame-list)))'"
if frameVisible is not "t" then
do shell script "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c -n"
do shell script "open -a Emacs"
end if
end try
还有 Emacs Daemon 的:
do shell script "/Applications/Emacs.app/Contents/MacOS/Emacs --daemon"
现在我的Emacs Client.app是这样的,用系统自带的“脚本编辑器”编辑。
try
do shell script "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c -e \"(select-frame-set-input-focus (selected-frame))\""
on error
do shell script "/Applications/Emacs.app/Contents/MacOS/Emacs --daemon"
do shell script "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c"
end try
1
henryshen233 OP 新建 AppleScript 文件然后保存为.app 文件到 Applications 文件夹即可
|