Re: Clicking iTunes 9 Genius button?
Re: Clicking iTunes 9 Genius button?
- Subject: Re: Clicking iTunes 9 Genius button?
- From: "David A. Cox" <email@hidden>
- Date: Fri, 11 Sep 2009 15:17:20 -0700
I have not seen any ideas on this list yet, so for I thought I would
share a little bit of crufty work around I have worked up for myself
(but it seem too delicate to send off to people):
-------------
tell application "iTunes"
activate
--Get the version of iTunes, so we can mix 8 and 9 installs for now
set this_version to the version as string
end tell
tell application "System Events"
tell process "iTunes"
keystroke "l" using command down --this draws focus to the active song
if this_version is less than 9.0 then
click (the first button of window "iTunes" whose help is "Start
Genius.") --this clicks the genius button
else --This else statement is lame, as the buttons move around
depending on conditions. We need a way to target the button directly
set buttonTitles to title of every button of window "iTunes"
if buttonTitles contains "Burn Disc" then
click button 17 of window "iTunes"
else
click button 16 of window "iTunes"
end if
end if
keystroke "l" using command down --this draws focus to the now
active genius playlist.
end tell
end tell
--------------
It might be more robust to always click the button that is one less
than the total, but this was the path I went down with the most common
'disruptor' to the regular button count. A real solution would be
great....
DAC
On Sep 9, 2009, at 3:38 PM, David A. Cox wrote:
This worked in iTunes 8 (if a song is playing in iTunes):
tell application "System Events"
tell process "iTunes"
keystroke "l" using command down --this draws focus to the active
song
click (the first button of window "iTunes" whose help is "Start
Genius.") --this clicks the genius button
keystroke "l" using command down --this draws focus to the now
active genius playlist.
end tell
end tell
But this does not seem to work in iTunes 9, as all of the buttons have
a missing value for their "help". I have not seen any other way to
find the button with UI scripting (finding it by count does not always
work as the number of buttons or layout may change). It would be
better if there was direct way to start a genius playlist, but I have
not seen that either.
Anyone have a way to do this?
DAC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
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