PDA

View Full Version : Help an AppleScript noob!




adamfishercox
Aug 3, 2011, 06:59 PM
I'm using AppleScripts and RemoteBuddy to manage Plex, Hulu Desktop, EyeTV, and Boxee on my Mac TV setup. I'm by no means a pro at AppleScript so I'd hope I could get some help here.

The goal is for the script to close whichever app is open, launch Boxee, and tab over to "Apps" and hit enter so that basically the button that I assign this script to will take me straight to the app screen. This works great for everything except Hulu Desktop. That section of the script just won't send the keystrokes. I've tried putting in delays everywhere and even had it send the keystrokes over and over just to test and it just won't send them. Any help?

tell application "System Events"
if exists process "EyeTV" then
tell application "Boxee" to launch
tell application "EyeTV" to close every window
tell application "Boxee" to activate
end if
if exists process "Hulu Desktop" then
tell application "Boxee" to launch
tell application "Boxee" to activate
tell application "System Events" to key code 124
tell application "System Events" to key code 124
tell application "System Events" to key code 36
tell application "System Events" to key code 124
delay 1
tell application "Hulu Desktop" to quit
end if
if exists process "Plex" then
tell application "Plex" to quit
tell application "Boxee" to launch
tell application "Boxee" to activate
delay 1
end if
end tell
tell application "Boxee" to activate
tell application "System Events" to key code 124
tell application "System Events" to key code 124
tell application "System Events" to key code 36
tell application "System Events" to key code 124