【问题标题】:Run commands in existing terminal window在现有终端窗口中运行命令
【发布时间】:2013-03-10 11:31:33
【问题描述】:

我想使用 applescript 在现有打开的终端窗口中运行命令。它不是一个普通的 bash 终端窗口,它是一个用于游戏服务器控制台(我的世界)的 java 终端

我以前从未写过applescript,所以我想边学边学。似乎我发现的所有 sn-ps 和教程都打开了一个新的 bash 窗口,但在这种情况下不起作用。例如

tell application "Terminal"
    try
        do script "save-all"
    end try
end tell

如何使用 applescript 在现有窗口中运行命令?

【问题讨论】:

    标签: terminal applescript automator


    【解决方案1】:

    试试:

    tell application "Terminal"
        do script "save-all" in front window    
    end tell
    

    【讨论】:

      【解决方案2】:

      您需要 A) 通过 ScriptEditor 编译您的 Applescript,然后以某种方式从您的 Java 终端调用该编译脚本 (does the "osascript" command work in that terminal?) 或 B) 您需要 write a native Objective-C tool 您可以从某种胶水层调用你的 Java 应用程序。

      Here is also a related question I just discovered 可能会为您提供一些有用的答案/提示。

      【讨论】:

        猜你喜欢
        • 2016-01-29
        • 2022-06-10
        • 1970-01-01
        • 1970-01-01
        • 2013-10-18
        • 1970-01-01
        • 2020-10-10
        • 1970-01-01
        相关资源
        最近更新 更多