Text to Speech batch program

Posted: January 8, 2015 in Notepad Tricks, Programming, Tech hacks

This program has one major function only, making your computer “speak” whatever you write in the program. This is accomplished by creating a separate (temporary) VBs file that makes SAPI speak whatever you write. This file is deleted afterwards.
Onto the code:
Note: I made a mistake, don’t use underscores, use hyphens. I have corrected this.

Step 1:

@echo off

title Text to Speech Conversion
color 0a

rem The user decides what to convert here
echo What do you want the computer to convert into speech?
set /p text=

rem Making the temp file
set num=%random%
if exist temp%num%.vbs goto num
echo ‘ > “temp%num%.vbs”
echo set speech = Wscript.CreateObject(“SAPI.spVoice”) >> “temp%num%.vbs”
echo speech.speak “%text%” >> “temp%num%.vbs”
start temp%num%.vbs
del temp%num%.vbs
goto input
If you do not want the screen to close for no reason, I suggest you follow the tip given and don’t use spaces; use hyphens (-) instead.

Have fun?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.