Dim message, sapi
message=InputBox("What do you want me to say?","SAPI")
Set sapi=CreateObject("sapi.spvoice")
sapi.Speak message
SAPI is Windows' Text-to-Speech functionality. This Visual Basic script will present you with an input box that will read back to you whatever you type into it. (Ok, this isn't immediately as useful as it is fun. But it's great for pranks, and you can find the script extremely useful once you learn to tweak it with Visual Basic.)
1. Open a new notepad file. Copy the above script into this new text document.

2. Save the file with any filename ending in the extension ".vbs" (script.vbs or talk.vbs, for example).

3. Double-click on the resulting icon to run the script. After you've entered your text in the box and pressed the button, the box will disappear and SAPI will read back what you've typed. (There may be a bit of a delay depending on your processor, but this WILL work if you have a valid install of Windows XP, Vista or 7.)

0 comments:
Post a Comment