一. 我的訴求
每次開機(jī)后, 我都需要打開iTermial, 輸入w2 start
啟動whistl, 然后打開谷歌瀏覽器輸入127.0.0.1:8899
, 我累, 想找個(gè)方法做到開機(jī)自動執(zhí)行這些操作
二. 開干
2.1 腳本
-- 打開 iTerm 并執(zhí)行 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 標(biāo)簽并執(zhí)行 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
-- 等待服務(wù)器啟動后兴想,打開 Chrome 并訪問指定網(wǎng)址
delay 3
tell application "Google Chrome"
activate
open location "http://127.0.0.1:8899/#network"
end tell
-- 打開企業(yè)微信
tell application "企業(yè)微信" to activate