Hi. I've been fiddling with this for a while now and am really hoping someone might have something to add.
Ever since we got iTunes'11, CMD-7 has taken me to "App list", and CMD-R to "My App Updates".
So, I wanted to create an iCal event that runs an AppleScript that starts iTunes, activates iTunes, presses CMD-7 and then CMD-R, and then I'd be able to wake up to a list of updated apps.
Did it work? Yes, and no. Then I fiddled with it a little bit more, and did it work? Yes, and no.
tell application "iTunes" to launch
tell application "iTunes" to launch
delay 2
tell application "iTunes" to activate
tell application "iTunes" to activate
tell application "System Events"
tell process "iTunes" to keystroke "7" using command down
tell process "iTunes" to keystroke "r" using command down
end tell
tell application "iTunes" to activate
tell application "System Events"
tell process "iTunes" to keystroke "r" using command down
end tell
Well, that kind of worked. If iTunes wasn't open, it was opened, activated, and cmd7+cmd-r would be pressed. If sometimes iTunes was slow to activate or somehow "lurched", the first cmd-r was ignored so hence why I added a second cmd-R, just to make sure.
But this took into consideration: nothing. For instance, if I had left work and left iTunes into the state where the Search Bar was active. I just couldn't, for the life of me, figure out a way to get away from the Search Bar. So, after a while, I updated the script to the 2nd iteration:
tell application "iTunes" to launch
delay 2
tell application "iTunes" to activate
tell application "System Events"
tell process "iTunes" to keystroke "l" using command down
tell process "iTunes" to keystroke "7" using command down
tell process "iTunes" to keystroke "r" using command down
end tell
Objective was to also use CMD-L, which "focuses on the song being played" (thus escaping away from the Search Bar. So I was happy for a while, up until I came to work and saw that nothing had actually happened. Why? Because, if iTunes is started for the first time, and nothing is playing, there's nothing to be done.
So, here's where I'm at now. I've got a half-working script, and I just can't for the life of me figure out how to get a clear cmd-7/cmd-r, no matter if search bar is selected, if iTunes is closed or open, or if iTunes is playing a song (and paused) or not.
How should I go about doing this, please?
Yours, Esa