0

为什么当我把它变成一个应用程序时这不起作用?我试图完成这项工作,但它所做的只是击键查找器中的命令而不是终端。它甚至可以在 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

谢谢

4

1 回答 1

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
于 2013-09-26T04:46:12.677 回答