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
:input
cls
echo What do you want the computer to convert into speech?
echo.
set /p text=
rem Making the temp file
:num
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
pause
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?