首页 > 解决方案 > 通过 Terminus 在 Atom 中运行服务

问题描述

我有一个script.py脚本,我希望能够从 Atom 的菜单栏运行。我在 Mac 上,所以我决定在 Automator 中创建一个快速服务,在其中运行 AppleScript:

on run {input, parameters}
    
    tell application "Terminal"
        do script "python3 /path/to/script.py"
        activate
        if exists (window 2) then
            close window 2
        end if
    end tell
    
    return input
end run

这很好用:它在菜单中创建一个条目(虽然我希望我可以通过右键单击而不是 Atom > Services > Script 来访问它),然后运行脚本。我在 Atom 中工作,希望脚本使用 Terminus 提示符,而不是打开一个新的终端窗口。我该怎么做呢?

标签: pythonapplescriptatom-editor

解决方案


推荐阅读