Applescript 为什么当我把它变成一个应用程序时,它就不起作用了?

Applescript 为什么当我把它变成一个应用程序时,它就不起作用了?,applescript,startup,Applescript,Startup,为什么当我把它变成一个应用程序时,它就不起作用了?我试图使这项工作,但它所做的只是在finder中的命令,而不是终端。它甚至可以在applescript编辑器中工作,而不是作为应用程序。请帮忙 on run tell application "Terminal" to quit delay 5 tell application "Terminal" to activate delay 3 tell application "System Events" to keystr

为什么当我把它变成一个应用程序时,它就不起作用了?我试图使这项工作,但它所做的只是在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

谢谢

请考虑以下结构:

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

考虑使用<代码> DO shell脚本< /C>命令,而不是使用终端窗口:<代码> DO shell脚本“打开-调酒师”<代码> >代码> shell脚本“打开-移动内存”/代码>等,或者使用<代码>告诉应用程序X激活< /代码>启动程序:<代码>告诉应用调酒师激活< /代码>,
告诉应用程序MobileMouseServer激活
,等等。