The VBScript Network and Systems Administrator's Cafe

Mar 10 2009   2:01AM GMT

Writing scripts that use speech with the Windows Speech API



Posted by: Jerry Lees
Office Agent, SAPI.SpVoice, Sound, Speech API, undocumented windows, VBScipt, VBScript Objects

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

Leave a comment: