The VBScript Network and Systems Administrator's Cafe

Mar 10 2009   2:01AM GMT

Writing scripts that use speech with the Windows Speech API

Jerry Lees Jerry Lees Profile: Jerry Lees

I’ve been looking for ways to make a script speak the information it needs to relay to the user just for fun and, unfortunately the only scripts I could find out there were extremely elaborate onces that use the Microsoft Office Agents. While they fit the bill they were annoying and required Microsoft office components to be installed… that just wouldn’t do.

Then I found the Windows Sound API. It doesn’t require anything at all to be installed and it works fine. The script below is simple and easy to implement in your code. Check it out:

strText = “Hello, there…. can you write code?”

Set objVoice = CreateObject(“SAPI.SpVoice”)
objVoice.Speak strText

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: