輸入AppleScript。
它沒有達到剛好你所描述的,但我認爲它足夠接近。你是否使用這個取決於你。
您可以使用此命令
osascript -e 'tell app "system events" to tell process "Terminal" to tell menu bar 1 to tell menu bar item "Shell" to tell menu "Shell" to tell menu item "New Window" to tell menu "New Window" to click menu item "Basic"'
,或者在展開形式
tell app "system events"
tell process "Terminal"
tell menu bar 1
tell menu bar item "Shell"
tell menu "Shell"
tell menu item "New Window"
tell menu "New Window"
click menu item "Basic" #or any other profile
end tell
end tell
end tell
end tell
end tell
end tell
end tell
要與所需的配置文件中創建一個新的終端窗口。 (在這個例子中,我使用的基本)
如果你得到錯誤
System Events got an error: osascript is not allowed assistive access
然後看看如何解決this SO answer by @NGAFD。
進入系統偏好設置>安全和隱私>隱私>輔助功能,並確保終端在列表中並被檢查。