2013-09-26 4 views
0

Почему это не работает, когда я делаю это приложение? Я пытаюсь сделать эту работу, но все, что она делает, это нажатие клавиш в finder not terminal. Он даже работает в редакторе 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

Рассмотрим с помощью 'сделать оболочки команду script' вместо того, чтобы использовать окно терминала:' сделать сценарий оболочки "открытым -a Бармен" ', 'make shell script 'open -a MobileMouseServer'' и т. д. – zneak

+0

Или использовать 'tell application X для активации' для запуска программ:' tell application Bartender to activate', 'tell application MobileMouseServer для активации' и т. д. – zneak

ответ

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 
Смежные вопросы