Sunday, June 28, 2009

Get Your Computer to Say What You Type [HowTo]

Windows comes with a built in voice system, which I wanted to utilize recently. In this guide, you’ll learn a Visual Basic script that is only a few lines, which will give you a popup box you can use to type in anything you want your computer to say.

This script utilizes Microsoft’s speech API, which is installed on most Windows XP, Vista, and Seven installations; if this guide does not work, you do not have the SAPI.

Speak to me!

Copy the following text and paste it into Notepad


Dim message, sapi
message=InputBox("What do you want me to say?","Speak to Me")
Set sapi=CreateObject("sapi.spvoice")
sapi.Speak message

Save the file as ‘speak.vbs‘ (be sure to include the .vbs)

Now double click on speak.vbs and you’ll see an input box. Type in your message, press enter, and listen to your computer speaking.

Get Your Computer to Say What You Type 1

If this Doesn’t Work…

You’ve probably run in to one of two problems:

1. Your browser displays the quotation marks differently. Go back to the Notepad file and replace all the quotes (”). Save the file and try again.

Get Your Computer to Say What You Type 2

2. You do not have the SAPI installed on your computer, so this will not work (very unlikely as this comes with Windows, but if you have a custom/pirate version this may be the case.)