当前行已包含某些文本时,在现有终端窗口中运行脚本

时间:2011-12-19 22:49:00

标签: applescript

如果最前面的“终端”选项卡中的当前行包含文本aa,则会运行命令aauptime

set cmd to "uptime"
tell application "Terminal"
    try
        do script cmd in window 1
    on error
        do script cmd
    end try
    activate
end tell

您显然可以在tell app "System Events" to keystroke "ku" using control down之前添加do script之类的内容,但有没有人知道更好的解决方案?

1 个答案:

答案 0 :(得分:0)

你知道你可以在不定位终端的情况下调用shell脚本吗,对吗?

相关问题