• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Script to force iTunes'11 to start and check for App updates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script to force iTunes'11 to start and check for App updates


  • Subject: Re: Script to force iTunes'11 to start and check for App updates
  • From: Brian Christmas <email@hidden>
  • Date: Sat, 06 Apr 2013 00:30:51 +1100

G'day Esa

Try this.

Regards

Santa

# Your part modified
tell application "iTunes"
activate
tell application "Finder"
repeat until exists process "iTunes"
delay 0.1
end repeat
delay 0.1
set theEnabled to exists window "iTunes"
tell application "System Events" to tell process "iTunes"
if not theEnabled then keystroke "1" using {option down, command down}
try
keystroke "7" using command down
end try
delay 1
keystroke "r" using command down
end tell
end tell
end tell
# My part
tell application "iTunes"
activate
delay 20 # Give update window plenty of time to show
tell application "Finder"
tell application "System Events" to tell process "iTunes"
keystroke "4" using {option down, command down} # opens downloads window, not necessary, just nice to see it
tell window "iTunes"
set buttonCount to (count of (buttons of UI element 1 of splitter group 1)) - 1
say buttonCount & " items to update." as text
end tell
repeat with eachButton from 1 to buttonCount
click button eachButton of UI element 1 of splitter group 1 of window "iTunes"
click
delay 1
end repeat
end tell
end tell
end tell








On 05/04/2013, at 8:26 PM, Esa Ruoho <email@hidden> wrote:

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.

1st iteration was this:
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
http://esaruoho.tumblr.com/
http://www.lackluster.org/
Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users This email sent to email@hidden
References: 
 >Script to force iTunes'11 to start and check for App updates (From: Esa Ruoho <email@hidden>)

  • Prev by Date: Script to force iTunes'11 to start and check for App updates
  • Next by Date: INDESIGN: Duplicating Char Style from One Doc to Another
  • Previous by thread: Script to force iTunes'11 to start and check for App updates
  • Next by thread: Re: Script to force iTunes'11 to start and check for App updates
  • Index(es):
    • Date
    • Thread