I need to make an script that picks a random sentence from a txt-file and says each word in a random voice, using an array of voices, speaking rate modulation and pitch.
For example: A sentence is chosen randomly from the txt file: "make a bed:listen carefully:read a book" and {"make", "a", "bed"} is spoken word-for-word by a random voice:
say "make" using "Fred" speaking rate 43 modulation 40 pitch 11
say "a" using "Bruce" speaking rate 101 modulation 50 pitch 91
say "bed" using "Kathy" speaking rate 138 modulation 18 pitch 31
I could use some advice, as I'm new to AppleScript and feel a little stuck. This is as far as I've gotten:
try
set myWordFile to (choose file with prompt "Select a file to read:" of type {"txt"})
open for access myWordFile
set wordContents to (read myWordFile)
close access myWordFile
set AppleScript's text item delimiters to ":"
set txtvar10 to words of wordContents
return txtvar10
end try
Thanks in advance :-)