Solved How to create a batch file for copying .txt to TTS Program?

March 4, 2016 at 03:12:49
Specs: Windows 7 Professional
Hello guys, I'm unfamiliar with writing batch files and have decided to ask the professionals for some help.

Basically, what I am trying to do is create a batch file that will copy a TEXT file into a Text to Speech program and read it to me.

Any help appreciated. Thank you in advance


See More: How to create a batch file for copying .txt to TTS Program?

Report •

March 4, 2016 at 18:51:48
✔ Best Answer
There should not be any need to copy anything - any TTS utility should accept a filename and then read the content, or perhaps in some cases, to read a literal submission. Without knowing what program you are using for TTS output, no way to know if anything needs to be done prior to text submission, but it should be "nothing". As for TTS utils, here is a very simple VBscript that allows both approaches (literal flagged by initial sgl-quote, else interpreted as a filename of a text file to be read).

'------- begin vbscript
set spk=createobject("sapi.spvoice")
set fso=createobject("scripting.filesystemobject")
' sgl quote indicates a literal submission vs textfile submission
if left(test,1)="'" then
for i=1 to wscript.arguments.count-1
test=test&" "&wscript.arguments(i)
wscript.echo "literal:"&test
spk.speak test
set x=fso.opentextfile(wscript.arguments(0),1)
do while x.atendofstream=false
wscript.echo z
spk.speak z
end if
'-------------------------- end vbscript 'SAY.VBS'
cscript [/nologo] SAY.VBS textfile_name|'literal_to_be_spoken

message edited by nbrane

Report •

March 4, 2016 at 19:43:54
Thank you very much. I forgot to mention that I was using Natural Reader 14. There was an option to use a straight text file there, but I had no idea how to make that work with a batch file.

I will incorporate your script into mine and see what happens. Thank you very much


Report •
Related Solutions

Ask Question