Speak return of script

How can I get the return of the following script to be spoken?

set today to current date
set time of today to 0
set tomorrow to today + 1 * days

tell application “Calendar”
set the_calendar to first calendar whose name is “main calendar”
tell the_calendar
set the_list to summary of every event whose start date is greater than or equal to today and start date is less than tomorrow
end tell
return the_list
end tell

Any help would be greatly appreciated,

googleman76

Hi googleman76,

What you’re trying to do shave the computer speak out a list?

Essentially yes, I want a script that will speak the events that I have in icalendar, when I wake up in the morning.

googleman76

Hello.

I don’t have Calendar, so I can’t make it work for you. But if you remove the return the_list statement from the tell “Calendar” block, and append the code below after the tell “Calendar” block (remove the fruits of my list, as they are just for demo), then you should hear your summaries.

set the_list to {"bananas", "oranges", "pears"}
set {tids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "[[ emph +]].. " & return}
set the_text to the_list as text
set AppleScript's text item delimiters to tids
say the_text

So do I just leave the { } blank? I am trying to speak the ical events that show up as a result of the applescript in my first post.

P.S. I am fairly new to applescript and don’t really know what I am doing

googleman76

I figured it out, I accidently put two set the_list block commands in there.

googleman76

Hi,

try


set today to current date
set time of today to 0
set tomorrow to today + 1 * days
--
tell application "Calendar"
	set the_calendar to first calendar whose name is "main calendar"
	tell the_calendar
		set the_list to summary of every event whose start date is greater than or equal to today and start date is less than tomorrow
	end tell
end tell
set {TID, text item delimiters} to {text item delimiters, return}
set textToSpeak to the_list as text
set text item delimiters to TID
say textToSpeak

:slight_smile:
I still recommend using the text item delimiter I created, curtsey of Mac Os X internals! as it is nice with a little break between summaries, with just a return, the summaries comes to close to each other.

It is of course a matter of personal preference.

set the_list to {"There was a young man of Japan", "Whose limericks never would scan.", "When asked why this was,", "He replied \"It's because", "I always try to fit as many syllables into the last line as ever I possibly can.\""}
set {tids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "[[ emph +]].. " & return}
set the_text to the_list as text
set AppleScript's text item delimiters to tids
say the_text