the main problem is, you have to convert the formatted text to plain text
because you won’t expect the result of speaking RTF text.
There is a convenient shell command textutil to do the conversion
set indigoAudioFolder to (path to music folder as text) & "iTunes:Indigo:Indigo Audio:"
set plainText to do shell script "textutil -convert txt -stdout " & quoted form of (POSIX path of indigoAudioFolder & "Text.rtf")
say plainText saving to file (indigoAudioFolder & "Text.aiff")
Seems I need to change the source file to an RSS folder in Documents.
This compiles but doesn’t do the conversion.
set indigoAudioFolder to (path to music folder as text) & “iTunes:Indigo:Indigo Audio:”
set sourceFolder to (path to documents folder as text) & “RSS”
set plainText to do shell script "textutil -convert txt -stdout " & quoted form of (POSIX path of sourceFolder & “Text.rtf”)
say plainText saving to file (indigoAudioFolder & “Text.aif”)
Did I miss something?
Many thanks,
Carl
Edit: Oops… forgot the : after “RSS”. All better. Thanks again for the help.
Turns out that the file I need to convert to an aif is a standard txt file, not an rtf.
Can this be modified to work using a txt file, not using the conversion?
set indigoAudioFolder to (path to music folder as text) & "iTunes:Indigo:Indigo Audio:"
set plainText to do shell script "textutil -convert txt -stdout " & quoted form of (POSIX path of indigoAudioFolder & "Text.rtf")
say plainText saving to file (indigoAudioFolder & "Text.aif")
set indigoAudioFolder to (path to music folder as text) & "iTunes:Indigo:Indigo Audio:"
set plainText to read file (indigoAudioFolder & "Text.txt")
say plainText saving to file (indigoAudioFolder & "Text.aif")