我正在尝试创建一个keyhortcut来打开当前文件夹中的终端 . 环顾四周,我发现这个代码创建了一个服务(添加了这个服务的快捷方式的部分已经解决了),只有添加的东西是“; clear”和一些“激活”所以它显示
on run {input, parameters}
tell application "Finder"
activate
set myWin to window 1
set theWin to (quoted form of POSIX path of (target of myWin as alias))
tell application "Terminal"
activate
tell window 1
activate
do script "cd " & theWin & ";clear"
end tell
end tell
end tell
return input
end run
它没有像我想的那样工作 .
烦恼:
-
它在终端打开两个窗口,不知道为什么 . 它与添加的"activate"无关......它一直都是这样做的
-
如果我在finder(文件夹)上选择一个项目,它会打开它的父目录,我希望它打开所选的文件夹
这是我对Applescript的第一次尝试,所以如果错误很明显我就是看不到它
提前致谢
2 回答
do script
命令已在终端中打开一个窗口 . 试试这种方式:我更喜欢重新开放的方法......