【问题标题】:How does one keep Alfred 2 from opening and entering your Terminal command in a new window when Terminal is already open?当终端已经打开时,如何阻止 Alfred 2 在新窗口中打开和输入终端命令?
【发布时间】:2014-03-10 00:48:52
【问题描述】:

我要进行哪些更改才能使其仅在终端尚未运行时打开一个窗口,否则在打开的窗口中输入命令?我在考虑控制流,条件下颚。我不知道怎么写出来。

谢谢,TJ

脚本如下:

on alfred_script(q)
    tell application "Terminal"
        activate
        do script q
    end tell
end alfred_script

【问题讨论】:

    标签: terminal applescript alfred


    【解决方案1】:

    试试:

    on alfred_script(q)
    tell application "Terminal"
        if not (exists window 1) then reopen
        activate
        do script q in window 1
    end tell
    end alfred_script
    

    【讨论】:

      【解决方案2】:

      检查这个:https://github.com/miromannino/alfred-new-terminal-window

      它会在当前空间中打开一个新的终端/iTerm 窗口。 按住 alt 键,新窗口也会在当前最前面的 Finder 文件夹中打开。

      与其他人相比,它真的更快,对我来说真的很重要,因为我几乎所有事情都使用终端! :)

      希望对你有帮助!

      【讨论】:

        猜你喜欢
        • 2013-12-25
        • 1970-01-01
        • 2010-12-20
        • 2021-12-09
        • 2015-11-04
        • 2020-05-14
        • 2021-11-27
        • 2018-02-03
        • 2022-01-04
        相关资源
        最近更新 更多