Make Your Windows XP Talk!

Published

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 ;)

Share

    Recommendations

    • Planter Challenge

      Planter Challenge
    • Oil Contest

      Oil Contest
    • Clocks Contest

      Clocks Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    62 Comments

    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

    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

    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, =.=

    2 replies

    @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 ;)

    Thanks so much!

    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

    3 replies

    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    =)

    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?

    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!

    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

    7 replies

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

    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! ;)

    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.

    umm, that is vbscript

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

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

    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

    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"