Introduction: Make Your Windows XP Talk!

This instructable shows you how to write a simple vb script that allows you to use the microsoft SAPI
(Speech application Programming Interface).

quick version history of the SAPI in windows:
SAPI 1.0 - 1995
SAPI 2.0 - 1996
SAPI 3.0 - 1997
SAPI 4.0 - 1998
SAPI 5.0 - 2000
SAPI 5.1 - 2001
SAPI 5.2 - 2004
SAPI 5.3 - With Windows Vista

Windows XP and Windows Server 2003 come with Microsoft Sam but you can also download Microsoft Mary and Microsoft Mike. To find which ones you have installed you can run this Vbs script:

Set objVoice = CreateObject("SAPI.SpVoice")

For Each strVoice in objVoice.GetVoices

Wscript.Echo strVoice.GetDescription

Next

Step 1: The First Step...

Open up notepad, and write the following vbscript in it:

Dim userInput

userInput = InputBox("Type below anything to hear you PC speak it!")

Set Sapi = Wscript.CreateObject("SAPI.SpVoice")

Sapi.speak userInput

==> the second line allows the showing of the input box in which the user will enter his sentence that is to be read by the pc
==> the first line declares the variable userInput
==> the third line declares the SAPI and creates its object
==> and the last line tells the SAPI what to readwhich is in this case the variable userInput

Step 2: Save You Work...

now after entering the script you have to save it in the form of vbs file
click save and write in the place were you name you file:

the name that you want.vbs

*remark: i mean by "the name that you want" the naming that you are free to put for your file

after you save, just double click on the script file and the program will run were you will enter yousentence and the pc will read it!

good luck
hope you like this instructable
please do make a comment, thanks ;)

Comments

author
KindelQ made it! (author)2014-12-16

Here is another text and instructions. This will repeat unless you get rid of 'do' and 'loop'.

Code Below and Above Dotted Lines

-------------------------------------------------------------------------------------------------------------

Set speech=CreateObject("sapi.spvoice")

Dim speaks, speech

do

"Anything here minus quotations and spaces"=("What the computer says.")

speech.Speak "Anything here minus quotations and spaces"

loop

----------------------------------------------------------------------------------------------------------

(For hidden files (http://www.bleepingcomputer.com/tutorials/show-hidden-files-in-windows-7/) (Works for more than windows 7)

Then go to Users/Your_Username/App_Data/Roaming/Microsoft/Windows/Start_Menu/Programs/Start_Up. Then drag the program (Saved the same way in the instructable) to that folder. Whenever you start your file, the program will run.

If you have do loop, to end it, got to task manager, process, and end wscript.exe

Thank You

author
jkirby5 made it! (author)2013-12-10

If you get rid of the input box and put the script in the startup folder you can scare coworkers and friends pretty good. I've got a similar how-to on my site with the appropriate changes in the code to do that. www.infotechtnt.com/talking-computers

author
kttecatt made it! (author)2009-01-09

I know this will probably sound like a stupid question, but, I am not very computer savvy. When you say, " just double click on the script file and the program will run were you will enter yousentence and the pc will read it!", what exactly does that mean? What is a script file? Thanks, =.=

author
SCRIPTmaster made it! (author)SCRIPTmaster2009-01-10

@kttecatt, after you save the file youfilename.vbs in notepad, a blue and white icon will appear where you have saved the file, just double click on it to start the program :) good luck ;)

author
kttecatt made it! (author)kttecatt2013-07-21

Thanks so much!

author
mc_dude made it! (author)2010-02-16

delete the XXXXX and add your name to make it look legit!
--------------------------------------------------------
 

msgbox ("Made by XXXXX!")

do

set wshshell=wscript.createobject ("wscript.shell")

strInput = InputBox("Type Bellow, To Hear It Spoken!", "text to talk")

If strInput = False Then
WScript.quit
Else
If Len(StrInput) = 0 Then
WScript.Echo "You did not enter anything. Try again"
Else

Dim userInput
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
Sapi.speak strInput

End If
End If

loop
-------------------------------
save it AS     talkit.vbs

author
mc_dude made it! (author)mc_dude2010-02-16

the loop is not a bad loop (by the way) if you push cancel and the x button it will close it...... and if you type nothing and lick ok it will propt you to actually type sommething than let you try again. made completly by me    =)

author
will421 made it! (author)will4212011-04-15

I've been licking okay, but nothing happened!
Is there something wrong with my monitor?
Do you have to have a proprietary tongue?
Do I have to upgrade to Windows 7?

author
will421 made it! (author)will4212011-10-28

Okay, I have upgraded to Windows 7, but it still doesn't work.
Can some one help me? I must know where I fix this problem where licking okay doesn't do anything!

author
QwertyuioLP made it! (author)2008-11-12

I've got a new code for this:

Dim userInput

userInput = InputBox("Type below anything to hear you PC speak it!")

Set Sapi = Wscript.CreateObject("SAPI.SpVoice")

Sapi.speak userInput
x=msgbox("Message here!!",vbBeep,"title here")

hope you like

author
TATcreator made it! (author)TATcreator2008-11-13

How is it supposed to work? We don't specialize in vbscripting, only batch.

author
SCRIPTmaster made it! (author)SCRIPTmaster2008-11-14

what fo you mean? everything is mentioned in the tutorial! btw, batch is becomin gmore and more outdated, what you can do in batch can be done in vbscript! ;)

author
will421 made it! (author)will4212010-12-06

Can you do stuff in a console that looks like its from wargames in VBS?
No.
Can you do stuff in a console that looks like its from wargames in Batch?
Yes.

author
munchman made it! (author)munchman2008-11-14

umm, that is vbscript

author
will421 made it! (author)will4212010-12-06

Exactly.

author
QwertyuioLP made it! (author)QwertyuioLP2008-11-17

All it does is speaks and then a pop up, pops up(bet u don't see that every day!)

author
will421 made it! (author)2011-09-06

I'm using this in a spelling test program for my teacher.
:D

author
Super_Nerd made it! (author)2011-08-02

Is there a way to make it listen from Speech recognition? The only way I've done it is make it open the SR program and create an Input box

author
davidprosser made it! (author)2009-08-07

If you want to make it speak when you click on the file, and have no box come up (like a mysterious voice) then use this code:

Dim userInput

Set Sapi = Wscript.CreateObject("SAPI.SpVoice")

Sapi.speak "Whatever you want to say"

author
davidprosser made it! (author)davidprosser2009-08-07

In fact I've improved on it - It will now delete itself once it has said the message - try out this code:

Dim userInput

Set Sapi = Wscript.CreateObject("SAPI.SpVoice")

Sapi.speak "Boo! I bet I really freaked you out! But don't worry, it's

about time a computer like myself could speak! Goodbye!"

Dim objFSO
'Create a File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Delete the currently executing script
objFSO.DeleteFile WScript.ScriptFullName
Set objFSO = Nothing

author
Super_Nerd made it! (author)Super_Nerd2011-08-02

You don't need the userinput variable.

author
Super_Nerd made it! (author)2011-02-15

I made this at school and turned my volume up and made it say...

Mamby Pamby Land tastes like cheese oh my I forgot to get brocolli for the cheese.

TTS.png
author
Super_Nerd made it! (author)2011-02-02

Hey, I put this into a program that reads the time. Try this link.

author
will421 made it! (author)2010-12-06

I made a nice little script out of this one:
Set WshShell = Wscript.CreateObject("Wscript.Shell")
Set Sapi = Wscript.CreateObject("SAPI.SpVoice")
WScript.Sleep(1000)
Sapi.speak "Hello."
WScript.Sleep(500)
Sapi.speak "My name is Sapi."
WScript.Sleep(700)
Sapi.speak "How are you?"
WScript.Sleep(1000)
Sapi.speak "I'm good too."
WScript.Sleep(400)
Sapi.speak "Have a nice day!"
WScript.Sleep(400)
Sapi.speak "Oh, and by the way, this script was made by will 421 also known as DabatchSquad, Dabatch, and will 4210"
WScript.Sleep(500)
Sapi.speak "I will write down the usernames for you in notepad. Here..."
WScript.Sleep(400)
WshShell.run "notepad"
WshShell.appActivate "Notepad"
WScript.Sleep(500)
WshShell.SendKeys "will421"
WScript.Sleep(500)
WshShell.SendKeys "{ENTER}DabatchSquad"
WScript.Sleep(500)
WshShell.SendKeys "{ENTER}Dabatch"
WScript.Sleep(500)
WshShell.SendKeys "{ENTER}will4210"
Sapi.speak "There. Goodbye!"

author
DTass made it! (author)2009-01-31

Do I Write the stuff in parenthesis

author
GeekBeam made it! (author)GeekBeam2010-02-10

yes

author
fatboy106 made it! (author)2009-03-20

mine just comes up: windows script host line:4 char:1 error:expected statement code:800a0400

author
GeekBeam made it! (author)GeekBeam2010-02-10

are you doing it on one line if so use the way he said up there except don't include the space in between

author
sushantparab made it! (author)2009-10-01

great

author
firesketch made it! (author)2009-09-06

Fantastic images, well done. I need to work on my illustration :/

author
alexman695 made it! (author)2009-07-06

cool

author
L0rd0fferret made it! (author)2009-06-15

how do you change to othervoice i have all three

author
cheesefetty made it! (author)2009-05-31

you can also go to control panel, then go to speech then VIOLA!!

author
hg341 made it! (author)2009-04-25

nice i now know a bit of .vbs

author
slu6alka made it! (author)2009-03-12

Ha this is awesome:) Do you know how to make it speak in other language?

author
Bert99 made it! (author)2009-02-24

I showed it to a bunch of teachers at my school and they loved it!

author
knoxarama made it! (author)2009-01-31

this works well. all you really have to do is copy/paste anyway. but i have something to add. when the box pops up, put ------------------ between all of your words. its makes the computer stop between words, otherwise it goes really fast.

author
knoxarama made it! (author)2009-01-31

this is weird! and it works!

author
ReCreate made it! (author)2009-01-26

"self destruct sequence initiated"...funny that part made me laugh

author
blugyblug made it! (author)2008-11-24

Another way is Control Panel --> (category view)--> sounds, speech and audio devices --> (normal view)-->Speech --> At the top click the tab that says "text to speech" Now select a voice, some of them sound really weird. And type inside the box and click preview.

author
wenpherd made it! (author)2008-11-23

how do you chang the voice, and can you make it so it responds when you talk to it i think you should try it

author
SCRIPTmaster made it! (author)SCRIPTmaster2008-11-23

hmm... i will try to do that for the next instructable maybe... ;)

author
wenpherd made it! (author)2008-11-23

this remind me of wargames it cool movie

author
stephen2803 made it! (author)2008-11-18

lol, this is realy good!thank you, do some more!

author
lolcat360 made it! (author)2008-08-17

it doesnt work :(

author
Knuten made it! (author)2008-08-09

Excellent! And I want to use it in my audio editing. I tried your first script and it said I have "Sam". I presume that's the male voice I hear. I'll also try to download the Mike & Mary voices... I presume from somewhere at Microsoft? Do you know where other voices, accents or languages can be downloaded? Thanks for the fun Instructable!!!

author
SCRIPTmaster made it! (author)SCRIPTmaster2008-08-11

thanks, and good luck in your audio editing :) , the voices can be downloaded easily with their documentation from the Microsoft website, i haven't tried them but they usually work and are easy to install, once they are set as your default SAPI voice on your windows they can work with this script just as the default one provided by windows which is sam. i have even more interesting Scripts to show you in my coming instructables!

author
jelly829 made it! (author)2008-07-26

Can someone make one that automatically speaks the thing i type in notepad when i click on the vbs? thanks

author
place name here- made it! (author)place name here-2008-08-09

change this

Dim userInput

userInput = InputBox("Type below anything to hear you PC speak it!")

Set Sapi = Wscript.CreateObject("SAPI.SpVoice")

Sapi.speak userInput

to this

Dim userInput

userInput = ("self distruct seqwence of hard drive initiated")

Set Sapi = Wscript.CreateObject("SAPI.SpVoice")

Sapi.speak userinput

About This Instructable

21,139views

29favorites

More by SCRIPTmaster:Make your windows read files writen in notepad!How to automatically shutdown your windows vista computer...Program your PC to turn off automatically by asigning which time you want it to do that
Add instructable to: