1
我想寫一個函數來創建一個選項卡並使用Apple腳本運行一個命令。Apple腳本來創建一個新標籤來運行bash命令
我已經試過
tell application "Terminal"
activate
my makeTab("desktop", "ls")
end tell
on makeTab(name, command)
do shell script command
tell application "System Events"
keystroke "t" using {command down}
delay 0.2
keystroke "i" using {shift down, command down}
keystroke tab
keystroke name
key code 53
end tell
end makeTab
結果
我一直得到
sh: eCmd: command no found
對我來說任何提示,我該如何使它工作?
當我運行你所建議的腳本'終端得到一個錯誤,我得到這個小錯誤: AppleEvent處理程序失敗。「任何想法? – ihue
嘗試在'key code 53'命令 – jackjr300
之後用'delay 0.3'命令在腳本中添加一行。好的。謝謝。 – ihue