Re: Thirteen Scripters Scripting
Re: Thirteen Scripters Scripting
- Subject: Re: Thirteen Scripters Scripting
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 24 Dec 2008 18:35:32 -0500
As long as we're posting improvements to David's nice holiday script
(Thanks, David!), the text-to-speech stuff is smart enough to deal
with numerals, so since Applescript knows how to count, you don't need
to include the numbers in the lists:
set ordinals to {"st", "nd", "rd", "th"}
set giftList to {"partridge in a pear tree", "turtle doves", "French
hens", "calling birds", "gold rings", "geese a-laying", "swans
a-swimming", "maids a-milking", "ladies dancing", "lords a-leaping",
"pipers piping", "drummers drumming"}
repeat with day from 1 to count (giftList)
set daysGifts to ""
repeat with n from day to 1 by -1
if length of daysGifts > 0 then
set daysGifts to daysGifts & ", "
if n = 1 then
set daysGifts to daysGifts & " and "
end if
end if
if n is 1 then
set num to "a"
else
set num to (n as text)
end if
set daysGifts to daysGifts & " " & num & " " & (item n of giftList)
end repeat
if day > count (ordinals) then
set suffix to the last item of ordinals
else
set suffix to item day of ordinals
end if
set nth to (day as text) & suffix
set verse to "On the " & nth & " day of Christmas my true love sent
to me " & daysGifts
say verse using "Alex"
end repeat
_______________________________________________
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