Hi,
I’m not too familiar with Apple Script, but what you have in the line you sent 
looks good.

Having it pause at end of song would be a great added function.

Thanks again for your help. I hope this script gets added to the repository.
Des Delgadillo
Reporter
desdelgadi...@gmail.com
(562) 652-3415

> On Apr 28, 2017, at 7:36 AM, Jonathan Cohn <jon.c.c...@gmail.com> wrote:
> 
> Hello, 
> 
> OK, I have made the script work a little better and am almost ready to send a 
> new copy out. 
> 
> Please update the below line with what you would want spoken: 
>       set TextToSspeak to SongName & " by " & ArtistName & " on album " & 
> AlbumName
> 
> Currently I have only tested this with Billy Joel and Bob Dylan, if you are 
> working with more classical types of music please also give me a couple 
> examples that I can play from Apple Music so I can make sure everything gets 
> filled out correctly,. 
> 
> If I remember correctly, you are using this for presentation purposes, so you 
> might want some other functions available, perhaps pause at end of current 
> song? Or maybe even the simple
> 
> tell Application "iTunes" to play
> 
> If anybody wants to explore the AppleScript handlers I would be glad to 
> discuss. 
> 
> Best Wishes,
> 
> Jonathan 
>  
> 
> On 26 April 2017 at 14:42, Des Delgadillo <desdelgadi...@gmail.com 
> <mailto:desdelgadi...@gmail.com>> wrote:
> I would prefer just having VO read out the song and artist. No dialogue 
> needed.
> Des Delgadillo
> Reporter
> desdelgadi...@gmail.com <mailto:desdelgadi...@gmail.com>
> (562) 652-3415 <tel:(562)%20652-3415>
>> On Apr 25, 2017, at 1:27 PM, Jonathan Cohn <jon.c.c...@gmail.com 
>> <mailto:jon.c.c...@gmail.com>> wrote:
>> 
>> I'm not quite sure what you're asking here. Do you want the dialogue or did 
>> you want the output would you want to be able to have a choose?
>> On Tue, Apr 25, 2017 at 3:02 PM Des Delgadillo <desdelgadi...@gmail.com 
>> <mailto:desdelgadi...@gmail.com>> wrote:
>> Thanks again for this.
>> I’ve got it set up to work with a VO hot key, but how can I get it to 
>> display in a dialog box or to just read out the next song?
>> 
>> Des Delgadillo
>> Reporter
>> desdelgadi...@gmail.com <mailto:desdelgadi...@gmail.com>
>> (562) 652-3415 <tel:(562)%20652-3415>
>>> On Apr 24, 2017, at 6:57 PM, Jonathan Cohn <jon.c.c...@gmail.com 
>>> <mailto:jon.c.c...@gmail.com>> wrote:
>>> 
>>> If you put the script into script editor and click play you should get a 
>>> dialog asking you to launch System Preferences. 
>>> 
>>> You need to go into the  Security and Privacy panel then click on Privacy. 
>>> 
>>> In the Privacy tab is a table where one of the items is accessibility. You 
>>> should see in the other table that Script Editor has asked for 
>>> accessibility access, and you need to check the box next to System 
>>> Preferences. I can give you more secure way where only this specific script 
>>> has accessibility access not all scripts, but this is the easiest way. 
>>> 
>>> Also, since I used the 
>>> tell application "VoiceOver" to output the SongName, you need to also make 
>>> sure the t allow Apple Script to control VoiceOver is checked.
>>> 
>>> ,  
>>>             Best wishes,
>>> 
>>> Jonathan Cohn
>>> 
>>> 
>>> 
>>>> On Apr 24, 2017, at 5:07 PM, Des Delgadillo <desdelgadi...@gmail.com 
>>>> <mailto:desdelgadi...@gmail.com>> wrote:
>>>> 
>>>> 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 <mailto:desdelgadi...@gmail.com>
>>>> (562) 652-3415 <tel:(562)%20652-3415>
>>>>> On Apr 22, 2017, at 6:15 PM, Jonathan Cohn <jon.c.c...@gmail.com 
>>>>> <mailto: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 
>>>>> <mailto:macvisionaries+modera...@googlegroups.com> and your owner is Cara 
>>>>> Quinn - you can reach Cara at caraqu...@caraquinn.com 
>>>>> <mailto: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 
>>>> <mailto:macvisionaries+modera...@googlegroups.com> and your owner is Cara 
>>>> Quinn - you can reach Cara at caraqu...@caraquinn.com 
>>>> <mailto: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 
>>> <mailto:macvisionaries+modera...@googlegroups.com> and your owner is Cara 
>>> Quinn - you can reach Cara at caraqu...@caraquinn.com 
>>> <mailto: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 
>> <mailto:macvisionaries%2bmodera...@googlegroups.com> and your owner is Cara 
>> Quinn - you can reach Cara at caraqu...@caraquinn.com 
>> <mailto: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 
>> <mailto:macvisionaries+modera...@googlegroups.com> and your owner is Cara 
>> Quinn - you can reach Cara at caraqu...@caraquinn.com 
>> <mailto: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 
> <mailto:macvisionaries%2bmodera...@googlegroups.com> and your owner is Cara 
> Quinn - you can reach Cara at caraqu...@caraquinn.com 
> <mailto: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/ 
> <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