【发布时间】:2013-09-26 04:23:14
【问题描述】:
为什么当我把它变成一个应用程序时这不起作用?我试图完成这项工作,但它所做的只是击键查找器中的命令而不是终端。它甚至可以在 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
谢谢
【问题讨论】:
-
考虑使用
do shell script命令而不是使用终端窗口:do shell script "open -a Bartender"、do shell script "open -a MobileMouseServer"等。 -
或者使用
tell application X to activate启动程序:tell application Bartender to activate、tell application MobileMouseServer to activate等
标签: applescript startup