4

我曾经在 Lion 中运行以下代码来打开终端,更新项目,然后打开一个新选项卡,然后再次运行以更新第二个、第三个和第四个。自从山狮升级后,这不再有效。一半时间似乎在我的主目录中打开 Finder,另一半时间似乎打开 OSX 字体/文本对话框。我已经确认 Cmd+T 仍应打开一个新选项卡。知道为什么它坏了吗?

tell application "Terminal" to activate

tell application "Terminal"

    do script "cd Projects/blahblah/trunk" in front window
    do script "svn up" in front window

end tell

tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
4

1 回答 1

6

事实证明,出于某种原因,我需要告诉终端在每次通话之间激活。狮子从来没有让我这样做。

tell application "Terminal" to activate

tell application "Terminal"

    delay 0.25

    do script "cd Projects/firstone/trunk && svn up" in front window
end tell

tell application "Terminal" to activate

tell application "System Events" to tell process "Terminal" to keystroke "t" using command down

tell application "Terminal"

    delay 0.25

    do script "cd Projects/secondone/trunk && svn up" in front window

end tell
于 2012-08-29T16:53:23.550 回答