一. 我的诉求
每次开机后, 我都需要打开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