Tuesday, 15 October 2013

Convert text files to audio

Convert text files to audio
-----------------------------

A post on how to convert text to audio had been posted on this page. So here is a trick to make the computer read out the entire contents of a text file.

1. Open notepad and paste the code given below:

Set sapi = CreateObject("sapi.spvoice")
Set fs = CreateObject("Scripting.FileSystemObject")
path = Inputbox("Enter path for the text file to read:", "#Expert Hackers")
If Not (fs.FileExists(path)) Then
X = Msgbox("The specified file does not exist!", 48, "ERROR!")
Else
Set a = fs.OpenTextFile(path)
text = a.ReadAll
sapi.Speak(text)
a.Close
End If

2. After pasting save as a .vbs file.

3. Open the vbs file and enter the path to the text file and press Enter.

4. If the specified file does not exist an error message will be displayed. If the file exists then the computer will start reading it out!

6. After the computer starts to read the text file if you want to exit the program open task manager by pressing Crtl+Shift+Esc and end the process "wscript.exe" under the Processes tab.



No comments:

Post a Comment