开机想执行一系列的动作该怎么办?

一. 我的诉求

每次开机后, 我都需要打开iTermial, 输入w2 start启动whistl, 然后打开谷歌浏览器输入127.0.0.1:8899, 我累, 想找个方法做到开机自动执行这些操作

二. 开干

2.1 脚本

-- 打开 iTerm 并执行 w2 start
tell application "iTerm"
    activate
    delay 1
    tell current window
        create tab with default profile
        tell current session
            write text "w2 start"
        end tell
    end tell
end tell

-- 新建 iTerm 标签并执行 python3 -m http.server 8080
tell application "iTerm"
    tell current window
        create tab with default profile
        tell current session
            write text "python3 -m http.server 8080"
        end tell
    end tell
end tell

-- 等待服务器启动后,打开 Chrome 并访问指定网址
delay 3
tell application "Google Chrome"
    activate
    open location "http://127.0.0.1:8899/#network"
end tell

-- 打开企业微信
tell application "企业微信" to activate

2.2 保存

image.png

2.3 添加到启动项

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容