Hopefully you checked out our new Sci-fi themes for Windows 7 by now, because we’re now making our computer talk!
Introduction: What We’re Attempting To Do
There are some free tools that you can download online to make your computer talk, however we want to keep it as simple as possible, so you can easily modify it and realize your own ideas, that’s why I was looking for a handy VBS (Visual Basic) script file that would allow us to make the PC speak text stored in a .txt file. Then we can dynamically change that text file so we can make your Windows 7 PC behave a little like Jarvis and speak about current world events, weather and so on
First Step: A VBS script would give us the most flexibility. For example, you can now retrieve information from websites using a scraper or RSS feed and simply echo it into a .txt file. Then you could create a very simply script that will speak out current information like news headlines or important events on your favorite website. The possibilties are endless, especially for geeks who may have their own server.
Second Step: Next, once we have a working script, we should assign it to a shortcut
Third Step: In a third step we could use a Kinect gesture pack to run this script whenever we make a certain gesture. With all of that we could create a really cool talking computer that recognizes when we’re up and then give us important information. Obviously this requires a little work, but a talking computer can be really nice if you don’t mind the generic voices.
The Realization – Part 1
Alright, on Stackoverflow I found this handy snippet:
Set objFSO = CreateObject("Scripting.FileSystemObject")
strAFile = Wscript.Arguments(0)
Set objFile = objFSO.GetFile(strAFile)
If objFile.Size > 0 Then
Set objReadFile = objFSO.OpenTextFile(Wscript.Arguments(0), 1)
strContents = objReadFile.ReadAll
objReadFile.Close
set ObjVoice=CreateObject("SAPI.SpVoice")
ObjVoice.Speak strContents
Else
Wscript.Echo "The file is empty."
End If
The script above can be called from a command prompt using a txt files as the first parameter. You may not know how to pass parameters via the command prompt, so we’ll quickly go through this. If you’re familiar with the Windows batch, skip this
1. Step Create a text file called speak.vbs – for example
2. Step When saving the file, MAKE SURE that you enter .vbs as the file extension AND select All Files from the dropdown
3. Step Copy and paste the code snippet from above into the text file and hit CTRL + S to save the script
4. Step Alright, now create another text file (.txt file extension) and insert some random text like Today the world is going to end
5. Step Next, we’re going to test that everything works properly. Open a command prompt and cd into the directory where you stored the VBS script for example cd C:\snippets. You may have to change the drive letter to switch the drive. Simply enter C:
or D:
and hit enter to switch to another driver, then enter your “cd command”
6. Step If you followed all steps 1-5 correctly, you should now hear a voice speaking the text that is stored in your text file
7. Step If you don’t hear anything, double-check that your .vbs file has been created correctly and has the little VBS icon and the type should be “VBScript Script File”
Create Batch Script To Easily Make Your Computer Talk
1. Step Create a new text file and this time save the file as a .bat file (select All files from dropdown when saving)
2. Step If you saved it correctly it should have that little gear icon:
3. Step Now enter exactly one line:
C:\snippets\speak.vbs mytextfile.txt
4. Step You may have to modify the path and name of your text file if you stored it somewhere else. If you run into problems, we suggest you follow our steps exactly
5. Step This is what the text file should look like:
Easy Accessibility: Pin The “Computer Voice” To Your Taskbar
1. Step Create a QuickLaunch toolbar as described here
2. Step Now you should have a dotted bar on the taskbar where you can drag and drop all sorts of files – including batch scripts
3. Step Drag the runner.bat onto the QuickLaunch bar
4. Step You can now simply click the BIG icon on your newly created QuickLaunch toolbar and the computer will speak to you. That’s already pretty cool, but how about assigning a shortcut to it instead
Create Shortcut To Make The Computer Talk
1. Step Right-click on your runner.bat file and select Send to => Desktop
2. Step Go to your desktop or browse to C:\Users\username\Desktop
via the Windows Explorer.
3. Step Right-click on runner.bat and select Properties
4. Step Click into the field Shortcut key
5. Step Hold the keys you want to use for this script e.g. CTRL + ALT + A
6. Step Click Apply
7. Step Hit the keys on your keyboard to test the shortcut
Now your computer should talk to you and read the text file that you created.
Next On The List: Dynamic Voice And Kinect Gestures
In our 2nd tutorial we’re going to show you how you can dynamically change that text file to retrieve recent information via the internet and then let your computer speak them out loud to you whenever you hit a shortcut or in another step with a Kinect gesture
Final Words: Part 2 And Your Ideas
Got some cool ideas for the perfect Sci-Fi themed PC or want to show us what you’ve done with this guide? Send us a mail to [email protected]
If any steps are not precise enough for you, please post a question and we’ll try to help
If you’re new to VB scripts then it wouldn’t hurt to read some basics about it online, but programming knowledge is strictly not required for this tutorial. I think everyone can make their computer talk with this handy guide
i was no successful in making my computer talk. my save file didnt have the option all files, so it went with word documents.is there here i went wrong. plz
Meena you need to open it with the notepad editor and then there will be the option “All files”
If that doesn’t work for you download notepad++ and it will work
When will we be seeing part 2? And will it be useable without a kinect?
Also waiting for 2nd part, would be awesome to talk to PC like in ironman, at least partly… :)
Part 2 is now available here http://windows7themes.net/make-your-windows-computer-talk-the-perfect-sci-fi-themed-pc-part-2.html