Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 84,952 times

Contents

Downloads

Related Categories

Text-To-Speech - The Code

alexreg

The Code

Step 2 - Declaring the Constants

The next step is to add the code. This code will say the caption of the button and then run a program depending on which button you clicked. Add this code to the general declarations:

Const Notepad = "c:\windows\notepad.exe"
Const Wordpad = "C:\program files\accessories\Wordpad.exe"
Const Paint = "c:\windows\Pbrush.exe"
Const Calculator = "c:\windows\Calc.exe"
Const Volume = "c:\windows\Sndvol32.exe"
Const InternetExplorer = "C:\Program Files\Internet Explorer\Iexplore.exe"
Const SoundRecorder = "c:\windows\Sndrec32.exe"
Const Clipboard = "c:\windows\Clipbrd.exe"
Const Dialer = "c:\windows\Dialer.exe"
Const Solitaire = "c:\windows\Sol.exe"

Step 3 - The Code

Now add this code under the click event of btnNumbers:

spkSpeak.Speak "You clicked button number " & btnNumbers(Index).Caption & "."

Select Case Index + 1
  Case Is = 1
    Shell Notepad, vbNormalNoFocus
  Case Is = 2
    Shell Wordpad, vbNormalNoFocus
  Case Is = 3
    Shell Paint, vbNormalNoFocus
  Case Is = 4
    Shell Calculator, vbNormalNoFocus
  Case Is = 5
    Shell Volume, vbNormalNoFocus
  Case Is = 6
    Shell InternetExplorer, vbNormalNoFocus
  Case Is = 7
    Shell SoundRecorder, vbNormalNoFocus
  Case Is = 8
    Shell Clipboard, vbNormalNoFocus
  Case Is = 9
    Shell Dialer, vbNormalNoFocus
  Case Is = 10
    Shell Solitaire, vbNormalNoFocus
End Select

   Then next piece of code will speak the text typed in the text box. Add this code to the btnSpeak click event:

spkSpeak.Speak txtText.Text

Currently programs in VB, QBasic, ASP, PHP, SQL, HTML, CSS, VBScript and some Java/JavaScript. Learning VB.NET.

Comments

  • Re: [1910] Text-To-Speech

    Posted by California88 on 16 Jul 2008

    I ran the program OK. When I create .exe and run on other computers, I get an error. What files are necessary to be installed on the other computers?

  • Re: [1910] Text-To-Speech

    Posted by neal2087 on 24 Mar 2007

    thanx for all the info u guys gave this helped me to learn how to use  the text-to-speech component
    the only thin i wanted to know was that how to make the lips move cause i had seen those li...

  • Re: [1910] Text-To-Speech

    Posted by clementchau105 on 14 Dec 2006

    hi,


    I would like to ask if it is possible to convert the text to spoken voice and save it inside a audio file such as .wav


    Thanks in advance

  • Posted by Nolan on 04 Aug 2005

    HI there you need install the text to speech engine and the Microsoft Reader.
    [url="http://www.microsoft.com/reader/developers/downloads/tts.asp"]Text -to-Speech Engine installer and Microsoft Reader...

  • Posted by jjrr007 on 31 Jul 2005

    I have installed all prerequisites, added the speech Active X control to the project and installed the voice feature. The updated VB.NET 2003 is available at:

    http://cybereshop.lmhost2.com/frmSpeak...