Hi Jonathan,
Sorry for the delay in responding.
Thank you for the script. Getting the song information in a dialogue box would 
be fine, it would even be ok if VO just read out the song title without 
displaying a dialogue.
I have limited scripting knowledge but I will try to run this script today. Can 
I just copy and paste the text of your script into the script editor?
Thanks again for doing this.

Des Delgadillo
Reporter
desdelgadi...@gmail.com
(562) 652-3415

> On Apr 22, 2017, at 6:15 PM, Jonathan Cohn <jon.c.c...@gmail.com> wrote:
> 
> I have a preliminary version of this script working using the Accessibility 
> API. What this means is that an administrator needs to authorize either the 
> script editor application or an application created from the script in order 
> for this script to run.
> 
> Right now I have it use VoiceOver to speak the name of the next song. There 
> is also a string that returns the Artist and Album.
> 
> To the person that was requesting this, what was the final requirement? Do 
> you want the information in a dialog box? Should it run just once, or be 
> checking on regular intervals to see if the up next has changed?
> 
> Perhaps you want me to attempt to insert the information into a Numbers sheet.
> 
> Text of script so far is below: note, I believe at least one of the handlers 
> is not being used.
> note 2 I put the UI Elements being accessed as properties at the top of the 
> script. 
> 
> use application "System Events"
> use scripting additions
> 
> property miniPlayerWindow : a reference to window "miniplayer" of application 
> process "iTunes"
> property ToggleButton : a reference to pop up button 2 of miniPlayerWindow
> property UpNextRadioButton : a reference to radio button "Up Next" of radio 
> group 1 of miniPlayerWindow
> property ScrollRegion : a reference to scroll area 1 of miniPlayerWindow
> property NextSongItem : a reference to static text 1 of UI element 1 of row 1 
> of table 1 of ScrollRegion
> property NextAlbumItem : a reference to static text 2 of UI element 1 of row 
> 1 of table 1 of ScrollRegion
> 
> on run
>       -- find the mini player or create it
>       ActivateMiniPlayer()
>       if description of ToggleButton is not equal to "hide up next" then
>               error "Who are we kidding, this should be the button. Perhaps 
> iTunes changed the arrangement"
>       end if
>       
>       if value of UpNextRadioButton = 0 then -- Up next needs to be selected 
>               click UpNextRadioButton
>       end if
>       
>       -- make sure information is visible 
>       set ScrollSize to size of ScrollRegion
>       if second item of ScrollSize is equal to 0 then -- hight = 0 
>               click ToggleButton
>       end if
>       
>       set Song to value of NextSongItem
>       set ALbum to value of NextAlbumItem
>       VoiceOverSpeech(Song)
>       return Song & ALbum
> end run
> 
> on VoiceOverSpeech(myText)
>       tell application "VoiceOver" to output myText
>       
> end VoiceOverSpeech
> on ActivateMiniPlayer()
>       set iTunesRunning to my ActivateIfRunning:"iTunes"
>       if not iTunesRunning then
>               error "You must be running iTunes for this script to work."
>       end if
>       tell application "iTunes"
>               if (not (exists miniplayer window 1)) then
>                       make new miniplayer window
>               end if
>       end tell
>       return {}
>       return window "MiniPlayer" of application process "iTunes"
> end ActivateMiniPlayer
> 
> 
> on appWithName(appName as {text, application})
>       set c to class of appName
>       if c is equal to application then
>               return appName
>       else if c is equal to text then
>               return application appName
>       end if
> end appWithName
> 
> 
> on ActivateIfRunning:appName
>       try
>               set frontmost of application process appName to true
>               set Success to true
>       on error
>               set Success to false
>       end try
>       return Success
> end ActivateIfRunning:
> 
>               Best wishes,
> 
> Jonathan Cohn
> 
> 
> 
> 
> -- 
> The following information is important for all members of the Mac Visionaries 
> list.
>  
> If you have any questions or concerns about the running of this list, or if 
> you feel that a member's post is inappropriate, please contact the owners or 
> moderators directly rather than posting on the list itself.
>  
> Your Mac Visionaries list moderator is Mark Taylor. You can reach mark at: 
> macvisionaries+modera...@googlegroups.com and your owner is Cara Quinn - you 
> can reach Cara at caraqu...@caraquinn.com
>  
> The archives for this list can be searched at:
> http://www.mail-archive.com/macvisionaries@googlegroups.com/ 
> <http://www.mail-archive.com/macvisionaries@googlegroups.com/>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "MacVisionaries" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to macvisionaries+unsubscr...@googlegroups.com 
> <mailto:macvisionaries+unsubscr...@googlegroups.com>.
> To post to this group, send email to macvisionaries@googlegroups.com 
> <mailto:macvisionaries@googlegroups.com>.
> Visit this group at https://groups.google.com/group/macvisionaries 
> <https://groups.google.com/group/macvisionaries>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
The following information is important for all members of the Mac Visionaries 
list.

If you have any questions or concerns about the running of this list, or if you 
feel that a member's post is inappropriate, please contact the owners or 
moderators directly rather than posting on the list itself.

Your Mac Visionaries list moderator is Mark Taylor.  You can reach mark at:  
macvisionaries+modera...@googlegroups.com and your owner is Cara Quinn - you 
can reach Cara at caraqu...@caraquinn.com

The archives for this list can be searched at:
http://www.mail-archive.com/macvisionaries@googlegroups.com/
--- 
You received this message because you are subscribed to the Google Groups 
"MacVisionaries" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to macvisionaries+unsubscr...@googlegroups.com.
To post to this group, send email to macvisionaries@googlegroups.com.
Visit this group at https://groups.google.com/group/macvisionaries.
For more options, visit https://groups.google.com/d/optout.

Reply via email to