Windows SAPI Using Visual Basic

I’m not a fan of visual basic in general, but there are a few pretty cool things you can do with visual basic. One of them is “speak through your computer” using a script.

This small visual basic script will allow you to type out anything you want spoken. If you prefer a female voice you simply change the text to speech settings on your windows computer. We have used this during conference calls to say silly things in a voice that our co-workers don’t recognize. I’ve seen hacker movies where the computer speaks to the person. How will you use this simple visual basic script?

Female Voice vs Male Voice

If you use windows 10, go to your settings and type in “speech”. You should find the “change text to speech settings”. There is a drop down for different voices. Select the voice you prefer.
speech settings
speech settings choose voice

Running the Script

vbs iconSave the code into a file that ends with .vbs and then double click the file. It should speak out in a computer voice and say “This program will talk whatever you type. Try it.”

Then it will loop back to the popup entry and allow you to converse by typing instead of speaking.

Visual Basic Source Code

If you want to just say 1 thing and close the program or not have it start out with “This program will talk whatever you type..” try the code below

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.