I would like to record the text read by an app as a sound file. Is there a script which does this?
I don’t remember who wrote this script (might of been from Apple – not sure though)
property voice_names : {"Agnes", "Albert", "Bad News", "Bahh", "Bells", "Boing", "Bruce", "Bubbles", "Cellos", "Deranged", "Fred", "Good News", "Hysterical", "Junior", "Kathy", "Organ", "Princess", "Ralph", "Trinoids", "Victoria", "Whisper", "Zarvox"}
property default_voice : "Victoria"
set this_voice to ""
set this_string to "Welcome to Mac OS Ten!"
try
repeat
display dialog "Enter the text to render to a sound file:" default answer this_string buttons {"Cancel", "Try", "Render"} default button 3
copy the result as list to {this_string, button_pressed}
if this_string is "" then
beep
else if the button_pressed is "Try" then
set this_voice to (choose from list voice_names default items default_voice with prompt "Pick the voice to use:") as string
if this_voice is "false" then
exit repeat
else
set default_voice to this_voice
end if
say this_string using this_voice
else
if this_voice is "" then
set this_voice to (choose from list voice_names default items default_voice with prompt "Pick the voice to use:") as string
if this_voice is "false" then
exit repeat
else
set default_voice to this_voice
end if
end if
set the target_file to choose file name with prompt "Name and location for the sound file:" default name "rendered.aiff"
say this_string using default_voice saving to target_file
exit repeat
end if
end repeat
on error error_message number error_number
if the error_number is not -128 then
display dialog error_message buttons {"Cancel"} default button 1
end if
end try