Intro: Make Your Windows Read Files Writen in Notepad!
Hi, I this instructable I will teach you how to make your windows xp read text files on your PC via a simple VBscript!. I made this instructable in response to some demand from a previous instructable that I made which is make your windows xp talk!
Anyways, this method uses the windows SAPI in order to read textfiles that are opened via a VBscript which opens the text file chosen, reads its contents and assigns a variable for them as this variable is then read(the contents are read) by the windows SAPI that will be called to read the variable
Follow up with this instructable to see a step by tutorial to make this cool and simple text reader!
Remark: after checking out this instructable please leave a comment about what you think about it and provide a rating, I will be more than happy to hear your comments! Thanks very much hope you like it and find it useful
Step 1: Write Up the Script...
First of all you should write up the program(VBscript that is responsible for all that reading). Open notepad and enter the following code in it!:
'Script written by Ayman Farhat (SCRIPTmaster)
'This script allows your PC to read contents of any text file you choose!
Const ForReading = 1
strText = InputBox("Please type in the name of the file you want to read the file, the file has an extension .txt","Read text files from notepad")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objText = objFSO.OpenTextFile(strText + ".txt", ForReading)
strText = objText.ReadAll
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
When you put the script save your work, when you save write the name of your script followed by.vbs extention as shown in the figure below
Step 2: Make the File You Want to Read...
After you have saved your script it is supposed to execute when you launch and prompts you to enter the name of the file that you want to read.
Therefore you should make a text file that has the information you want to read when you are typing it up in notepad. Open notepad write whatever you want there and save it with the default extension which is usually .txt as shown below.
Step 3: Test Your Work!
After having the file saved and the script ready now you can read the contents of the file that has been saved either while opening it and working on it or if it is closed(it doesnât matter), but what matters is that the file you are reading should be saved in the directory that contains the script, for example if your file that you want to read is stored in my documents then the script you are going to launch in order to read the file should also be stored in my documents.
Now you can run the script and read the contents of the file whether it is opened or closed as shown in the figure below.
Have fun! Hope you find that useful!