我想做的是当我将文件拖到emacs上时,有一个automator脚本在emacs中打开一个文件,并将终端放到前面。
现在,当我尝试将输入设置为〜/ Desktop / test.txt时,它会打开主页面,或者以〜/ Desktop / testtxt结束。我做错了吗?有更好的方法吗?
这就是我现在所拥有的:
set thePath to POSIX path of input
tell application "Terminal" to do script "emacs"
tell application "System Events"
tell process "Terminal"
activate
delay 2
keystroke "x" using control down
delay 1
keystroke "f" using control down
delay 1
keystroke thePath
delay 1
keystroke return
delay 1
end tell
end tell
return input
end run
答案 0 :(得分:1)
使用文件路径作为emacs
on run {input}
tell application "Terminal"
repeat with i in input
do script "emacs " & quoted form of POSIX path of i
end repeat
activate
end tell
return input
end run