如何使用Applescript在两个终端窗口中运行两个shell脚本?

时间:2012-09-28 04:01:35

标签: applescript window-management

我无法弄清楚Applescript代码在两个窗口中运行两个不同的shell脚本。

到目前为止我得到的是......

set s1 to "echo A"
set s2 to "echo A"
tell application "Terminal"
    activate
    tell window 0
        set visible to true
    end tell
    set shell to do script s1 in window 0
    tell window 1
        set visible to true
    end tell
    set shell to do script s2 in window 1
end tell

但这会在一个窗口中显示所有内容。这让我很生气,请帮忙!

1 个答案:

答案 0 :(得分:1)

默认情况下do script不会打开新窗口吗?

tell application "Terminal"
    activate
    do script "echo A"
    do script "echo A"
end tell