使用applescript运行emacs并打开文件
我想做的是,当我将一个文件拖到emacs上时,让一个自动机脚本在emacs中打开一个文件,并将终端放在前面 现在,当我尝试将输入设置为~/Desktop/test.txt时,它要么打开主页,要么以~/Desktop/testtxt结束。我做错了吗?有更好的方法吗 这就是我现在拥有的:使用applescript运行emacs并打开文件,applescript,Applescript,我想做的是,当我将一个文件拖到emacs上时,让一个自动机脚本在emacs中打开一个文件,并将终端放在前面 现在,当我尝试将输入设置为~/Desktop/test.txt时,它要么打开主页,要么以~/Desktop/testtxt结束。我做错了吗?有更好的方法吗 这就是我现在拥有的: set thePath to POSIX path of input tell application "Terminal" to do script "emacs" tell application "Syste
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
将文件路径用作
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