|
|
Help an AppleScript noob
|
|
|
|
Professional Poster
Join Date: May 2007
Status:
Offline
|
|
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?
Code:
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
|
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Feb 2000
Location: Nashua NH, USA
Status:
Offline
|
|
I notice in the other two sections your closing the other application before manipulating boxee. Try quiting hulu and then put a while delay loop in till the process is gone before activating boxee.
|
|
|
|
|
|
|
|
|
Professional Poster
Join Date: May 2007
Status:
Offline
|
|
I've tried that as well, I'll try it with a really long delay just to see if Hulu is hanging.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Nov 2002
Location: Rockville, MD
Status:
Offline
|
|
It might be because you have a tell block within a tell block, both towards System Events. What happens if you take out the "tell app System Events to" part (of the inner blocks), leaving just "key code x"?
|
|
|
|
|
|
|
|
|
hayesk
|
|
Originally Posted by Uncle Skeleton
It might be because you have a tell block within a tell block, both towards System Events. What happens if you take out the "tell app System Events to" part (of the inner blocks), leaving just "key code x"?
I think it's this.
Also, to simplify, you don't need to launch and activate. telling an app to activate will launch it too.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|