Wednesday 6 July 2011

A VB Program Which Will Speak Whatever You Type



Here is a code written in visual basic which has a simple gui and easy to use.

Here is what you have to do:
    1. Firstly open notepad.
    2. Now copy and paste the below code there:

        do

           'create the voice object

           Set VObj = CreateObject("SAPI.SpVoice")

           'get what the user wants to say, exit if cancel or return no msg

           MSG = InputBox("Type what you want the PC to say" & VBCRLF & VBCRLF & VBCRLF & "To End enter Nothing or push the Cancel button", "Voice Box By NILZWORLD", "")

             If MSG = "" Then WScript.quit: Else

               'use the VObj to speak msg

               with VObj

                 .Volume = 100

                 .Speak MSG

               end with

         loop

    3. Now save the file as filename.vbs
    4. Now double click on the file to use it.
I hope you will like this simple program.Njoy


No comments:

Post a Comment