This was fun...
on run
tell application "Finder"
display dialog ¬
"Type in some text" default answer "OK"
set dialogInfo to result
set theText to text returned of dialogInfo
set displayString to "Input rate (160-210)"
set defaultAnswer to "160"
repeat
set response to display dialog displayString default answer defaultAnswer
try
set theRate to (text returned of response) as number
if theRate < 160 or theRate > 210 then
error "Please enter a rate between 160 and 210"
end if
exit repeat
on error errstr
beep
set displayString to errstr & return & displayString
set defaultAnswer to text returned of response
end try
end repeat
set theVoice to choose from list {"Agnes - female voice", ¬
"Albert - male voice", ¬
"Bad News - singing funereal voice", ¬
"Bahh - an old male voice", ¬
"Bells - singing, ringing bell effect voice", ¬
"Boing - a springy effect voice", ¬
"Bruce - male voice", ¬
"Bubbles - bubble effect voice", ¬
"Cellos - singing voice", ¬
"Deranged - a nervous voice", ¬
"Fred - male voice", ¬
"Hysterical - laughing voice", ¬
"Junior - young boy's voice", ¬
"Kathy - female voice", ¬
"Pipe Organ - singing organ effects voice", ¬
"Princess - young girl's voice", ¬
"Ralph - deep male voice", ¬
"Trinoids - alien voice", ¬
"Victoria - female voice", ¬
"Whisper - whispering voice", ¬
"Zarvox - alien voice"} with prompt "Choose a voice"
set theVoice to word 1 of (theVoice as text)
set theText to " [[rate " & theRate & "]] " & theText
set theFileName to (path to desktop as text) & "myFile.aif"
say theText using theVoice saving to theFileName
tell application id "com.apple.quicktimeplayer"
activate
open theFileName
play document 1
end tell
end tell
end run