为什么当我将其设为应用时,这不起作用?我试图使这项工作,但它所做的只是在finder而不是终端键击命令。它甚至可以在applescript编辑器中使用,而不是作为应用程序。请帮忙!
on run
tell application "Terminal" to quit
delay 5
tell application "Terminal" to activate
delay 3
tell application "System Events" to keystroke "n" using {command down}
delay 1
tell application "System Events" to keystroke "top" & return
delay 1
tell application "System Events" to keystroke "n" using {command down}
delay 1
tell application "System Events" to keystroke "open -a Bartender" & return
delay 1
tell application "System Events" to keystroke "open -a MobileMouseServer" & return
delay 1
tell application "System Events" to keystroke "open -a gfxCardStatus" & return
delay 1
tell application "System Events" to keystroke "open -a Caffeine" & return
delay 1
tell application "System Events" to keystroke "open -a Alfred" & return
delay 1
tell application "System Events" to keystroke "open -a smcFanControl" & return
delay 1
tell application "System Events" to keystroke "w" using {command down}
tell application "Finder" to display dialog "System startup successful." with title "T.R.A.V.I.S." with icon file "Macintosh HD:SCRIPTS:ICNS:travis.icns" giving up after 5
end run
由于
答案 0 :(得分:0)
考虑这个结构:
tell application "Terminal"
if not (exists window 1) then reopen
-- targets an existing window
do script "top" in window 1
-- open a new window
do script "open -a Bartender"
end tell