Quick Search for:  in language:    
Learn,talk,your,computer,respond,even,nice,li
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,011,557. lines
 Jobs: 115. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
Locate Database
By Erica Ziegler-Roberts on 6/30


Organize the errors of your programs
By Toni on 6/30


how to open and close access database
By Freebug on 6/29


Click here to see a screenshot of this code!PSC-Browser
By Ralph LONG Metz on 6/29

(Screen Shot)

Click here to see a screenshot of this code!Quadratic Solver 2
By Guillaume Couture-Levesqu e on 6/29

(Screen Shot)

Click here to see a screenshot of this code!Array Example
By Cold Fire on 6/29

(Screen Shot)

Click here to see a screenshot of this code!Reconstructor 3.0
By Peter Scale on 6/29

(Screen Shot)

Click here to put this ticker on your site!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Talk To Your Computer

Print
Email
 

Submitted on: 2/9/2003 5:32:09 PM
By: MTGiga  
Level: Intermediate
User Rating: By 41 Users
Compatibility:VB 6.0

Users have accessed this article 16077 times.
 

(About the author)
 
     Learn how to talk to your computer, and have it respond! You even have a nice little robot buddy to talk to!

This article has accompanying files

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.

Talking to your computer!

Learn how to speak to your computer with Microsoft Speech Recognition along with a character to talk to with Microsoft Agent!

By: Michael [MTGiga] Gerwitz

mTecnology

Anyone can talk to their computer! However, it just sits there like a rock not knowing you even said anything. If it does, then it sure as heck wouldn't understand you!

Microsoft has solved this problem. With one simple ActiveX control, we have the ability to talk to our computer. And with another simple control, we can add a professional character too!

  • First, we need to download the Speech Recognition Engine (6 MB)
  • Download and install it using the link above
  • Click HERE for the download site. Click on the Speech Control Panel button and download it.
  • After it is installed, click on the first link in the index. Download and install it.
  • Click on the link below it, and choose a character from the dropdown list. I like Robby the robot the most. There is also a bird (Peddy), and Genie, and Merlin. You can use the others later. If you do not choose Robby, things will not make sense.
  • Then click on the download button to download the character. Install it, then continue with the next step.
  • Now download the next two links, and install those. That will allow the computer to speak back to us. You should have clicked on every link but one.

So far, that should be easy. If you could not follow it, we clicked on every link in the contents at the top of the page except the bottom one. It may seem like we are ready, but we really aren't...

Training

If you try to speak to the computer now, it will have a very hard time "understanding" you. So, we need to train it.

  • Enter the Control Panel. It can be found in the Start Menu.
  • Find the Speech icon, and click on it. A dialog will open.
  • Click on the "Other" tab at the top, the second one.
  • Click on the "SAPI 4 Control Panel..." button to open yet another dialog.
  • Click on the text in the list that reads "Microsoft Speech Recognition Engine 4.0 (English)" at the bottom.
  • Click on the "Training..." button. Another dialog will open.
  • NOTE: You may have done this already during the setup. It is wise to do it again, though.
  • Choose a session from the list. None are too exciting...
  • Click on the 'Next >' button to take you to the next screen.
  • Get your microphone ready, because once you click on 'Next >' again, you will have to speak!
  • It will ask you to read the story. Do NOT read abnormally! Read like you normally do so it learns how you speak.
  • When you are done, it will update the computer. Keep doing it until you seem comfortable. The more times you do it, the better it will get to know you!

Once that is done, you computer will better understand you. It takes a lot of work to get it good. Mine gets it correct about 90% of the time, but I still need work.

Bringing It Together

Now we are finally ready to start making our program. As I sit here typing this, I wonder exactly what this will do. Well, I now know, and you will know soon enough. Just follow all of the steps to get the final working program and be amazed at what Microsoft can do for us...

  • Open Visual Basic and start a new Standard EXE project.
  • Rename the form 'frmMain' and delete its caption property. The form will never be visible, so we do not need to worry about this.
  • Set its Visible property to 'False' so we can not see it. We only want to see our little Agent.
  • We now need to add the ActiveX controls to our project.
  • Right-click on the toolbox and select 'Components'
  • In the list, find and select Microsoft Agent Control 2.0 and Microsoft Direct Speech Recognition
  • You will see an ear and an agent appear in your toolbox.

We now have everything we need added to our project. We can now start to make it happen! We now must create a list of our commands to be loaded from a text file.

Grammar

Open up Notepad. We must create our own file to load the grammar and vocabulary from. It will only recognize what we enter in this document. So, enter the following:

[Grammer]
type=cfg
[]
=Show Yourself

=Hide Yourself

=Speak

=Execute Notepad

=Execute Microsoft Paint

=Execute Microsoft Visual Basic

=Display Character Map

=Disallow Commands

=Reallow Commands

=Hibernate

=Make Repairs

=Tell Me a Joke

=What Is My Fortune

=Play Number Guessing Game

=Status Report

=0

=1

=2

=3

=4

=5

=6

=7

=8

=9

=10

=Animate

=Display Animation List

=Display System Information

=System Shutdown

=System Reboot

 

Save it in the same directory as the project, naming it 'words.txt'. Now that our grammar list has been created, we can load it into our program. We first need to place the ActiveX controls onto our form.

 

ActiveX Controls

 

Drag the two new controls onto the form (the ones that look like an agent and an ear). Name the ear-like one 'Reco', for it will be our Speech Recognition Engine. Then, set its 'Visible' property to 'False'. Next, nam ' e the agent 'Agent', so all you have to ' do is erase the one. This does not have a visible property.

 

Our Agent

 

Before we load the list we just created, let's create our Agent object. You do not have to do it in this order, but I just want you to see what our character will look like. Create a new module and name it 'modMain'. Enter the following code in the General Declarations section (at the top):

 

Public Bot As IAgentCtlCharacterEx

This creates a new Agent character from an external source. Therefore, we will have to load it. Double click on frmMain and enter the following code:

Agent.Characters.Load "Robby", "robby.acs"
Set Bot = Agent.Characters("Robby")
Bot.Show

Bot.Play "Wave"
Bot.Speak "Hello!"
Bot.Speak "How are you doing today?"

Bot.MoveTo 200, 200

That is it! If you run the program now, you will see your robot wave to you, speak, then move. Let's take a look at the code.

The first two lines load the bot. The 'robby.acs' is the file we load it from. The third line shows our bot. The Bot.Play "Wave" line will play his 'Wave' animation. We will take a look at ' animating much more in the future. Then, we tell the bot to speak with Bot.Speak. Finally, the MoveTo command will move the bot to a different part of the screen.

Before you move on, try to do some different things with it. Modify what it says when it appears, move it to a different position on the screen.

Loading the Grammer

We can not speak to the computer until we load the list we just created. Enter the following code above all the code we just put in the Form_Load procedure:

Reco.GrammarFromFile App.Path & "\Words.txt"
Reco.Activate

To see if it loaded correctly, we will make a simple example. If you speak a phrase we created, it will output it to the debug window. Please note that it may not recognize you every time. Only speak what is in our list. Double-click on Reco and enter this in its Phrase_Finish procedure:

Debug.Print Phrase

As you speak, look in the Debug Window. If it outputs any of the phrases listed in Words.txt, we can continue.

Responding

How do we respond to this? Well, we need to replace the one line of code we just entered with a little more:

On Local Error Resume Next
Debug.Print Phrase

Select Case Phrase
    Case "Show Yourself"
        Bot.Show

    Case "Hide Yourself"
        Bot.Hide

End Select

Please note that it is case sensitive, so you must type it exactly as it appears above. All we do is output the phrase said to the Debug Window, then check it. These two phrases are the basic ones, they show and hide the bot. If it is 'Show Yourself', then the bot will be displayed. If it is 'Hide Yourself', we will hide the bot. I ' t is that simple. Try it out and see if ' it works for you. Please be patient, it may take a while to recognize...

Speaking

We will now program our bot to speak to us. Please modify the above code so it looks like this:

 

On Local Error Resume Next
Debug.Print Phrase

Select Case Phrase
    Case "Show Yourself"
        Bot.Show

    Case "Hide Yourself"
        Bot.Hide
 

    Case "Speak"

        BotSpeak


End Select

 

In the above code, we only added two lines. It will call a sub procedure which will randomly choose something for our bot to say. In modMain, create a new sub procedure named 'BotSpeak':

 

Public Sub BotSpeak()


    Randomize


    Dim r As Integer
    r = Int(16 * Rnd)

    Select Case r
        Case 0
            Bot.Speak "I love you!"

        Case 1
            Bot.Speak "You are amazing!"

        Case 2
            Bot.Speak "Make me a sandwich!"

        Case 3
            Bot.Speak "I'm tired..."

        Case 4
            Bot.Speak "Hello!"

        Case 5
            Bot.Speak "Dreams do come true!"

        Case 6
            Bot.Speak "Solve the equation 8(2x + 3) - (5x + 3x + 4)"

        Case 7
            Bot.Speak "What is the meaning of life?"

        Case 8
            Bot.Speak "I hate you, go away!"

        Case 9
            Bot.Speak "Make me!"

        Case 10
            Bot.Speak "I'm so happy being with you!"

        Case 11
            Bot.Speak "Have you read the book 844454XC50?"

        Case 12
            Bot.Speak "I want some self time..."

        Case 13
            Bot.Speak "Humans are obsolete!"

        Case 14
            Bot.Speak "I can not wait to take over your world!"

        Case 15
            Bot.Speak "South Park rules!"

    End Select
End Sub


 

You should be able to understand that. We first choose a random number. Then, we tell the bot to speak the text accociated to that number. That is it! Run the program, say "Speak", and see what it says. Feel free to change the text to whatever you'd like.

 

Executing Applications

 

This is a very easy topic to cover. All you have to do is add the following code to what we currently have in the Phrase_Finish procedure:

 

Case "Execute Notepad"
    Shell "C:\Windows\NOTEPAD.exe", vbNormalFocus

Case "Execute Microsoft Paint"
    Shell "C:\WINDOWS\SYSTEM32\mspaint.exe", vbNormalFocus

Case "Execute Microsoft Visual Basic"
    Shell "C:\Program Files\Microsoft Visual Studio\VB98\VB6.exe", vbNormalFocus

Case "Display Character Map"
    Shell "C:\WINDOWS\SYSTEM32\charmap.exe", vbNormalFocus

The 'Shell' command will execute an EXE file. The first parmeter is the Path, where the executable is located. The second is the focus. Do you want it to have the focus, do you want it to be minimized, maximized, or normal?

Disallow and Reallow

Before we get started, add a public Boolean variable named 'Disallow'. Now, add the following code ' at the top of the Phrase_Finish procedure:

If Phrase = "Reallow Commands" And Disallow Then
    Bot.Play "DoMagic1"
    Bot.Play "DoMagic2"

    Bot.Play "Idle1_1"
    Disallow = False
    Bot.Speak "Welcome back!"
End If

If Phrase = "Disallow Commands" Then
    Bot.Play "DoMagic1"
    Bot.Play "DoMagic2"

    Disallow = True
    Bot.Play "Idle1_1"
    Bot.Speak "I will wait for your return!"
    Exit Sub
End If

If Disallow Then Exit Sub

Run the program and say 'Disallow Commands'. Now, try to get it to speak. You can't. Now say 'Reallow Commands'. It can speak again! This is good if you don't want someone messing around with your bot.

Hibernating and Making Repairs

These are only two animations. Hibernating will, of course, but it to sleep. Make Repairs will make him take off his head, and make repairs. Add the following code:

Case "Make Repairs"
    Bot.Play "Idle2_2"

Case "Hibernate"
    Bot.Play "Idle3_2"

You should understand that tiny amount of code. These two animations can also be played if you leave your bot alone long enough.

Jokes

This is the same concept as speaking. You can just copy the BotSpeak procedure and replace the lines with jokes. I will give you two. You can come up with some of your own. Enter the following code in the Phrase_Finish procedure:

Case "Tell Me a Joke"
    TellJoke

Now, create the sub procedure in modMain:

Public Sub TellJoke()
    Dim r As Integer
    r = Int(2 * Rnd)

    Bot.Play "GetAttention"

    Select Case r
        Case 0
            Bot.Speak "Why didn't the chicken cross the road?"
            Bot.Speak "Because he was chicken!"

        Case 1
            Bot.Speak "Why didn't the man cross the road?"
            Bot.Speak "Because he didn't want to!"
            Bot.Play "Confused"

    End Select

    Bot.Play "GetAttentionReturn"
End Sub

Say "Tell Me a Joke" and listen. If you have any good jokes that are yours (I have millions of them, but they are not mine. That is why they are not on here), feel free to send them to me!

Fortune Telling

Again, this is very similar to joke telling and speaking. Enter the following lines in the Phrase_Finish procedure:

Case "What Is My Fortune"
    TellFortune

Now, create the procedure in modMain:

Public Sub TellFortune()
    Dim r As Integer
    r = Int(14 * Rnd)

    Bot.Play "Process"

    Select Case r
        Case 0
            Bot.Speak "Do not go outside tomorrow..."

        Case 1
            Bot.Speak "Keep looking behind your back!"

        Case 2
            Bot.Speak "In the sky is your answer!"

        Case 3
            Bot.Speak "ERROR - DEATH TOO SOON!"

        Case 4
            Bot.Speak "Hold on to your belongings..."

        Case 5
            Bot.Speak "I see great things in your future!"

        Case 6
            Bot.Speak "Do NOT answer the door!"

        Case 7
            Bot.Speak "tomorrow will be a great day for you!"

        Case 8
            Bot.Speak "It says - 'NEXT BIRTHDAY'"

        Case 9
            Bot.Speak "I'd rather not say!"
            Bot.MoveTo 10, 10

        Case 10
            Bot.Speak "Take shelter!"
            Bot.Hide

        Case 11
            Bot.Speak "You will be married tomorrow!"

        Case 12
            Bot.Speak "You are dead, I'm afraid..."
            Bot.Think "Ha ha ha ha ha!"

        Case 13
            Bot.Speak "ERROR - MISPRINT"

    End Select
End Sub


There is something new up there. Bot.Think. Instead of speaking, the agent displays a cloud with the text in it. The rest we have already gone through.

Number Guessing Game

This is a tiny bit more involved. First create a Boolean variable in modMain called InGame, and an Integer variable named GuessNum. Now, put this at the top of the Phrase_Finish sub:

If InGame Then
    GameInput Phrase
    Exit Sub
End If

Now, add this to the same procedure:

Case "Play Number Guessing Game"
    PlayGame

We have two procedures to create. Let's start with PlayGame:

Public Sub PlayGame()
    GuessNum = Int(11 * Rnd)

    Bot.Play "Explain"
    Bot.Speak "You have three tries to guess the number I am thinking of."
    Bot.Speak "I will tell you if you are too high or too low..."

    Bot.Play "Process"
    Bot.Speak "I am thinking of a number between 0 and 10..."

    InGame = True
End Sub

This procedure explains what you are to do, and chooses a number. It then sets the InGame variable to 'True' allowing us to bypass all other commands and worry only about the numbers we are guessing:

Public Sub GameInput(Phrase As String)
    If Phrase = "0" Or Phrase = "1" Or Phrase = "2" Or Phrase = "3" Or Phrase = "4" Or Phrase = "5" Or Phrase = "6" Or Phrase = "7" Or Phrase = "8" Or Phrase = "9" Or Phrase = "10" Then

        Dim tmpNum As Integer
        Static GNum As Integer

        If GNum = 3 Then GNum = 0
        tmpNum = Int(Phrase)

        If tmpNum > GuessNum Then
            Bot.Speak CStr(tmpNum) & " - Number too high"

        ElseIf tmpNum < GuessNum Then
            Bot.Speak CStr(tmpNum) & " - Number too low"

        ElseIf tmpNum = GuessNum Then
            Bot.Play "Congratulate"
            Bot.Speak CStr(tmpNum) & " - That is correct!"
            If GNum = 0 Then Bot.Speak "WOW! First Try!"

            InGame = False
            Exit Sub
        End If


        GNum = GNum + 1

        If GNum = 3 Then
            Bot.Play "Sad"
            Bot.Speak "You did not get it..."
            Bot.Speak "The correct number was " & CStr(GuessNum) & "..."

            InGame = False
        End If
    End If
End Sub


This is really some simple code. I simplified the first line so it is easier to understand. We check to see if what the user said is actually a number. If it is, we continue. If not, we bypass it. Then, we reset the tries count (GNum). Then, we change the string into an integer and store it in tmpNum. The bot will then inform us if it is too high or too low. If we are correct or take our three turns, the game is over.

Status Report

This is nothing good. I just added this because every robot must have status reports. It is also here if you decide to turn your robot into a pet like a tamagotchi (I did). Every time, the bot will say he is operating a optimum efficiency:

Case "Status Report"
    Bot.Play "Explain"
    Bot.Speak "I am operating at optimum efficiency!"

Animation

If you've looked at Microsoft Word or any of the Office products, you can animate the agents. Yes, they are agents, so keep this in mind: YOU CAN USE THEM IN YOUR APPS!

First, we are going to create the Animation List. Follow these simple steps:

  • Create a new form and name it frmAni

  • Add a ListBox control to it, naming it lstAni

  • Add three CommandButtons: cmdPlay, cmdStop, and cmdCancel

  • In cmdStop, add this line of code: Bot.Stop

  • In cmdCancel, add this line: Unload Me

There, now we have the form set up. Make sure Option Explicit is not at the top of the code for the form, then double-click on it and add the following code to the Form_Load procedure:

For Each AnimationName In Bot.AnimationNames
    lstAni.AddItem AnimationName
Next

This will loop through all the animations and add them to our list. You will see this soon. Add this to cmdPlay's code:

    On Error GoTo ErrOut
    Bot.Stop
    Bot.Play lstAni.Text
    Exit Sub

ErrOut:
    Bot.Speak "ERROR - UNABLE TO PLAY"

This will play the currently selected animation in the list. If there is an error, our bot will tell us.

Now, we need to add the code for 'Auto Animation' when the user says 'Animate'. It will choose one from the l ' ist, play it, and never show the form. Add a public Boolean variable named SelfAni in the General Declarations section of the form, and add the following code below the other in the Form_Load procedure:

If SelfAni Then
    Dim r As Integer
    r = Int(lstAni.ListCount * Rnd)
    lstAni.ListIndex = r
    Bot.Stop
    Bot.Play lstAni.Text
    Unload Me

End If

If SelfAni is true, then it will not display the form and choose a random animation. You will see how we will do this momentarily, so add the following code in the Phrase_Finish procedure:

Case "Display Animation List"

    frmAni.SelfAni = False
    frmAni.Show

Case "Animate"
    frmAni.SelfAni = True
    frmAni.Show

Run the program and test out our two new commands. What do you think?

System Information

Another very easy topic. Enter the following code into the Phrase_Finish procedure:

Case "Display System Information"
    Shell "C:\Program Files\Common Files\Microsoft Shared\MSINFO\msinfo32.exe", vbNormalFocus

This program will display your systems information. Our bot has to do something that has to do with our computer.

Shut Down

These are the two last commands. By now, my wrists are getting pretty sore from typing all of this! Add the following code above everything in modMain:

Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Boolean
Public Const EWX_LOGOFF = 0
Public Const EWX_REBOOT = 2
Public Const EWX_SHUTDOWN = 1

Now, we are almost done. As you know, we are only doing Reboot and Shutdown. You can program Logoff, which is pathetically simple (as you will soon see). Add the following code to finish this off:

Case "System Reboot"
    Dim reboot As Variant
    reboot = MsgBox("Are you sure you want to reboot?", vbYesNo, "Reboot?")

    If reboot = vbYes Then
        Screen.MousePointer = vbHourglass
        ExitWindowsEx EWX_REBOOT, 0
        Unload Me
        End
    End If

Case "System Shutdown"
    Dim down As Variant
    down = MsgBox("Are you sure you want to shutdown?", vbYesNo, "Shutdown?")

    If down = vbYes Then
        Screen.MousePointer = vbHourglass
        ExitWindowsEx EWX_SHUTDOWN, 0
        Unload Me
        End
    End If

Tips

Well, that is it! We are done. But before I go, here are some tips and notes:

  • You can use Office's agents, and office can use the ones you downloaded

  • I just scrapped the surface, there is much more to learn.

  • Add another agent, you can use more than one!

  • If you have any questions, E-mail them to me!

  • Please Vote!!!

winzip iconDownload article

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzipto decompress it.

Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:
1)Re-scan downloaded files using your personal virus checker before using it.
2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
3)Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.


Other 10 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
2/9/2003 8:44:11 PM:Anthony Dale Moore
I was looking for something on this very subject! Thanx
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/9/2003 9:05:39 PM:Stanky Cheese
dude, i told my friend about this and hes already hooked on training his bot ;) thx man! this is an awesome tutorial!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/9/2003 9:06:18 PM:Stanky Cheese
im giving u the best vote :-D
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/9/2003 9:16:13 PM:MTGiga
Thank you for your comments! I'll add to the tutorial to make it much better, and hopefully submit it next month. :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/9/2003 10:10:13 PM:Dhaval Faria
this is very cool.. I know how to do all this things, but I was facing prob. with the grammar thing, I was not able to create my own grammar, I mean I was not knowing how to make my own grammr, now I came to know.. thanks dude.. 5 globes from me.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/9/2003 10:16:01 PM:Dhaval Faria
one more thing.. wanted to tell you.. also check out my submision of this month on pscode.com only, please vote for it and also comment it.. heres the link: http://www.pscode.com/vb/defaul t.asp?lngCId=42883&lngWId=1 thank you, Dhaval Faria.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2003 2:49:43 AM:eXQue
MT, By looking over your nice and LONG tutorial..this is a very nice application. 5 globes for you
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2003 6:36:53 AM:
You Rule!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2003 8:50:31 AM:Mitja
Finaly something usefull on PSC, after we seen lots of crapi how insert into text only numbers and other stuff like this
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2003 10:02:02 AM:
An question on the part u need to add a sub directory to modMain , how to do that ? :$
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2003 12:34:27 PM:Anthony Dale Moore
How would I close, say the vb shell, from this program without closing it manually? Please help. unfortunately I can only give you a five! =0)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2003 3:59:29 PM:Mike Howell
This is truely awesom, i have been waiting for something on this subject to come along for ages. I feel like creating more usernames just to vote for you...:)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2003 4:11:55 PM:MTGiga
Thanks, guys! Okay, first question. How do you add sub PROCEDURES. It is simple. Just type in 'Sub', 'Public Sub', or 'Private Sub'. An example would be: Public Sub Main() MsgBox "This is a sub procedure!" End Sub I hope that helps. As for closing an app outside it, I'll have to look that up. I hope this helps!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2003 6:33:33 PM:-=TheASP=-
This is great, looks like you put alot of work into it, too bad I can only give you a 5.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2003 8:44:01 PM:MTGiga
The addition to this tutorial is comming along nicely. I am about 1/4 done.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/10/2003 8:47:46 PM:UlTrA PrOgRaMmEr
Wow not bad this is probably the best thing i've seen on psc. Great tutorial. Thanx (OOOOO) from me. <-)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2003 12:09:06 AM:MTGiga
Phew! I didn't think I'd ever get back on! It is now 12:08. I've been up making sure the site would get back up and running. For those of you who weren't here, the site was down for 2-3 hours. When it got back up, it had problems... It STILL has problems. They must have lowered the Timeout... Anyway, I'm proud to report that nothing was lost and everything is OK!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2003 12:52:17 AM:Anthony Dale Moore
Cool I hate to be a bum. BUT...Lol. I have looked in numerous places for the way to end an app .from outside, and have found several referances to Killing an app. But unfortunately no examples. Anyway I've chosen Peedy,and began work on creating an A.I. Using your examples this is not hard, just lots of typing. I also have found many other agents if your interrested I can send you the links.|:0)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2003 8:37:21 PM:Stanky Cheese
DUDE! PLZ HELP ME! i installed all the stuff i have the speech thing but there is no other tab! plz respond as FAST as possible!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2003 9:12:06 PM:
Hey this is my first time ever useing VB6 or useing any code other than HTML. I am stuck on "Loading the Grammer" part I can't seem to find any debuging window.. so if any one could help me please do!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2003 9:25:45 PM:MTGiga
The debug window is the tiney little window that is displayed when you click on the little play button at the top of the screen, or hit F5. If you do not see it: 1) Hit F5 to run the program 2) Right-Click on the toolbar and select 'Debug' 3) Click on the little box that has an exclamiation point on it. NOTE: The debug window is also called the 'Immediate Window' and is labeled like that in VB. --Mike
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2003 9:27:50 PM:MTGiga
If you do NOT have the 'Other' tab in the 'Speech' control pannel, then you did not download and install it correctly (see the first few paragraphs of my tutorial).
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2003 9:47:19 PM:JonahDrummer
This is Really cool MT, really shows the power of VB something I never knew it was able to do. This tut marks a new age for help desk everywhere. 5 globes
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/11/2003 10:53:53 PM:MTGiga
Before I continue with the next tutorial, does anyone want it? If you do, make a post. If I get good in the ranks too (if alot of people like this), I will.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 8:09:12 AM:Stanky Cheese
Hey, MTGiga. I need some help. When i click the speech icon in the control panel there is no "Other" tab. Please respond as quick as possible. I am running WIN2k. my AIM name is f4h6. my msn name is dieworms@hotmail.com my new email is dieworms@hotmail.com
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 8:10:11 AM:Stanky Cheese
SORRY! I did not see what you posted :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 8:24:00 AM:Stanky Cheese
:( I have installed everything 3 times over again and it still doesnt work. any help here? go to www.splisks.com/spoon/pictures/needhelp. gif to see my problems
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 8:25:10 AM:Stanky Cheese
<font color="RED"> SORRY PEOPLE LOOK AT THIS ONE</font> :( I have installed everything 3 times over again and it still doesnt work. any help here? go to www.splisks.com/spoon/needhelp.gif to see my problems
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 8:30:21 AM:MTGiga
I am not sure... Try contacting a Microsoft Professional. Sorry.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 8:31:04 AM:MTGiga
Please also note that you do not HAVE to do the training. It would make you life much easier, but you don't HAVE to.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 8:32:02 AM:Stanky Cheese
SORRY!!! I meant www.splisks.com/Spoon/needhelp.gif with a capital S in spoon ;-)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 9:09:38 AM:
Hi, sweet program! about the closing the program from outside I think you can use API "ExitProcess" dont know how to really use it lol but it works.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 9:12:11 AM:
Here is the code for that: Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long) Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long Private Declare Function GetCurrentProcess Lib "kernel32" () As Long Private Sub Form_Load() ExitProcess GetExitCodeProcess(GetCurrentProcess, 0) End Sub
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 9:16:31 AM:
Sorry im new at posting the code above is kinda messy but I think you can figure it out also my name isnt showing ones with out names are mine sorry for the posts in a row. QuadZilla
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 9:51:41 AM:MTGiga
Oh! You are already in that dialog. There is not going to be a tab there EVER. Okay, this should be much easier! Just click on the last row of text you see, then click on 'Training...'. That is it!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 9:54:17 AM:MTGiga
Okay, I will figure out how to use the APIs you posted, and get that back to you. I will also find a spot for it in the next tutorial.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 1:57:17 PM:Anthony Dale Moore
Thanx for the help QuadZilla. I just thought it would stand to reason, voice activated....voice shut down. I thought it would be kool. I would be interrested in a second tutorial. A small suggestion. I'm finding out as I go, It might be easier if your going to have a long select case to put it in a module, and after the allow/disallow, and number game if statements just make a call.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 2:11:21 PM:Anthony Dale Moore
Dude that works great for killing the Agent. lol. I'll work on it and figure out how to kill the other apps. but thanx again.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 3:26:00 PM:Stanky Cheese
ok well does anyone know my result? www.splisks.com/Spoon/needhelp.gif theres the picture for my problem
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 3:29:40 PM:MTGiga
I already posted your result, Stanky Cheese. Also, the next tutorial WILL but the code into many different modules to organize it. That is the first thing I typed.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 3:53:13 PM:[V]orpheus
This was a good help and just what i was looking for :-)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 4:20:16 PM:MTGiga
There seems to be a problem with PSC! If you want to vote, please come back when they fix the problem. I have already contacted them.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 5:31:48 PM:Anthony Dale Moore
Cool just tryin to be helpful. And if your interrested in closing Apps. Here you go! In SELECT CASE: Case
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 5:32:09 PM:Anthony Dale Moore
ByVal dwProcessId As Long) As Long Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) _ As Long Function IsItRunning(CName As String, who As String) As Long IsItRunning = FindWindow(CName, who) End Function Public Sub TerminateProcByHwnd(ByVal hwnd As Long) Const PROCESS_ALL_ACCESS = &H1F0FFF Dim ThreadIDX As Long Dim PROCESSIDX As Long Dim EXCODE As Long Dim PROCESS As Long ThreadIDX = GetWindowThreadProcessId(hwnd, PROCESSIDX) PROCESS = OpenProcess(PROCESS_ALL_ACCESS, 0, PROCESSIDX) Call GetExitCodeProcess(PROCESS, EXCODE) Call TerminateProcess(PROCESS, EXCODE) Call CloseHandle(PROCESS) End Sub
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 5:36:30 PM:Anthony Dale Moore
Sorry this first In SELECT CASE: Case "Close VB" iRet = IsItRunning("wndclass_desked_gsk", vbNullString) Call TerminateProcByHwnd(iRet)Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long IN MODULE: Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long,
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 6:12:38 PM:MTGiga
I am not yelling at you, Anthony! I'm just telling you. I usually NEVER yell at people. If anything I ever say makes anyone feel bad, please tell me. Also, thank you for the code snippet. If you would like me to put it in the tutorial (giving you the credit, of course), I can. :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 6:13:52 PM:MTGiga
I've read over all the comments again, and saw that this is turning into a chatroom! This is not a bad thing at all, I like it. The same people keep comming back and posting. Lol! :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 6:15:58 PM:MTGiga
One more thing: Do you guys want the next tutorial to be an addition to the current project, or just telling you what to do and not adding on? I am fine with either.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 6:52:46 PM:Anthony Dale Moore
I didnt take it wrong, and its up to you on including the api, but im not interrested in the credit. I found the code on psc in several different projects and just edited, and pieced them together to meet my need. Also either way you want to do the next one will work. Probably the reason your getting so many responses is because how cool it is. I mean there is nothing else on psc like it.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/12/2003 10:10:00 PM:MTGiga
Thanks for the compliment, Anthony! If I use it, I'll still give you credit for helping.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/13/2003 1:34:12 AM:Abrian Stemmet
cool!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/13/2003 2:09:59 AM:Agret
THIS IS SUPER 1337, 5 ***** ¤¤¤¤¤ ~~~~~ ----- ===== [][][][][] well you get the idea lmao
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/13/2003 4:07:29 AM:Peter Winter-Smith
This is a nice tutorial, I hadn't looked into MSAgent before and this got me started. Five out of Five!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/13/2003 5:46:15 AM:
Hmm it wont work for me on WIN ME, but it looks good :) An error: Line 17: The property name OleObjectBlob in reco is invalid. And also it winges about: reco.GrammarFromFile App.Path & "\Words.txt" NOTE: I download the ZIP
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/13/2003 6:21:22 AM:
My computer can't regonize my voice?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/13/2003 11:34:50 AM:Sub-Zero
Hi! your tutorial is great. I just posted a small app based on it. Go check it out and tell me what you think! http://www.planetsourcecode.com/ vb/scripts/ShowCode.asp?txtCodeId=43172& lngWId=1
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/13/2003 4:22:23 PM:MTGiga
That is a good program! I'm glad you learned something from my tutorial! It can be VERY useful for the handycap... Anyway, thank you for giving me credit! Most people wouldn't do that. Just for that, I will give them the link to your code in the next tutorial!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/16/2003 9:10:13 PM:
Yes!!! Please do make the next tut! I would really like it if you kept us posted. You have my vote!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/16/2003 10:04:13 PM:max7098
I followed your code exactly, and my microphone is definately working properly, but when I give it any command, nothing shows up in the debugger window and the agent does not respond. Perhaps there's another way without using the Debug Window?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/16/2003 11:22:27 PM:max7098
I downloaded Sub-Zero's command button program that he made based off of this tutorial, and his also did not work inside of VB, but when I compiled it and ran it, it worked fine! Someone help!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/17/2003 2:24:05 AM:
I did everything right so far, but when i speak to the computer , no phrase comes up in the debug window, everything is correct what ive done tho, any suggestions on what i might be doing wrong?? 5 out of 5 if i get some help ;)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/17/2003 8:49:45 AM:max7098
I downloaded the code that goes a long with this tutorial, and realized your words.txt has "<start>" before each "=" and between the two brackets. I guess I missed that part of the tutorial or something. My program now works fine! Very nice tutorial, 5 globes from me.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/17/2003 9:53:41 AM:MTGiga
I am having a few problems with my computer, and I just restored it. The next tutorial may not be done by the beiginning of next month, but I will try my best. It will include the first tutorial, modified. They will both include full explinations of the code, and I will now explain the obvious for the beginners, because I understand that this is an exciting topic many beginners want to dive right into.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/21/2003 6:58:45 AM:
Wicked!!! 5 globes from me.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/22/2003 11:27:11 PM:
I am downloading the 6MB file now, I so want it to finish, your tutorial looks real good and i can't wait to try.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/25/2003 12:15:38 AM:
This is really great. I ahve made my robot do lots of things but one thing I can't work out is how to make him quit by saying 'Quit Robot' unload me does not close that character just makes him do nothing and stand there
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/27/2003 3:02:23 PM:
Try bot.hide Do while bot.visible = true loop end Really Kool! Robbie does an exit, then the program ends!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2003 3:49:06 PM:
your tutorials are great, thanks for the code
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/1/2003 7:32:11 PM:Gavin Gault
Yea great code 5 globes from me:) One question how do you get them to speak as in the computer voice as well as the text ballons Thanks
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/3/2003 2:29:55 PM:
I have been trying to use the Speech Recognition to create a "Spelling Word" atmosphere for my 7 yr old son. Thaks very much for taking the time to show us this wealth of knowledge. Not only have you lead us to it... you have spelled out exactly how to use it. You get 5 from us! Excellent!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/30/2003 3:41:26 PM:
Hey Great Work, i have one small prob everything works till i input the print code Private Sub Reco_PhraseFinish(ByVal flags As Long, ByVal beginhi As Long, ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As Long, ByVal Phrase As String, ByVal parsed As String, ByVal results As Long) Debug.Print Phrase End Sub am i doing anything wrong??
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/30/2003 3:45:51 PM:
Nevermind i got it to work 5 stars
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/31/2003 10:14:55 PM:
Really nice. I need to buy a microphone firstly for my laptop to try out the tutorial but I've read through it already. Please post another tutorial with some cool features like how to turn the agent into a pet or something!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/8/2003 10:34:32 PM:MTGiga
I have gotten several requests for a pet, so I have decided to make one in my SPARE TIME. Therefore, it may be a while, but I AM looking toward next month (MAY 2003)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/13/2003 7:46:55 PM:MTGiga
I have finished the Peedy Project (the voice-activated pet)! I will post it hopefully next month when the tutorial is finished. I'd like to thank all of you for your support, and hope to hear from you again!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/12/2003 5:25:44 PM:
Ok i got everything going except in the debug window its not showing any inputs! And the robot wont understand my voice, i downloaded all that junk and did the speech reconization but still no go! Help?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/25/2003 7:32:03 AM:
It's very good program, but if there is anyone who can help me to get a more powerfull program useing the same way but insted of use a file txt, to use a database of voices to be compared when the user speakes to the PC, the programe(the code in VB) must identefy his voice and do the comand he order it to do. if there anyone can help me to get a source-code or information a bout how can i Use PC (by speaking to the PC) pleaze E-mail me as fast as You can, at "w_feras79@hotmail.com" i very thankfull to the staf how is behinde every thing a bout this website Keep Going Borthers...... WAKED FERAS.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/26/2003 2:29:23 PM:
Really great proggie!<BR> I'm giving you a fiver.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/27/2003 8:28:21 AM:Jonas Ask
Great tutorial! But I have a problem, I've never been able to get the Speech reco to work. For some reason the Reco_PhraseFinish sub (or other related subs) never executes. I.e. nothing happens when I speak into the mic, I know it's on and working. The training thing worked perfectly.. any idea? =)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/27/2003 10:43:20 AM:
two things wrong, my d drive is "gone" and i dont have a microphone! looks like a promising tutorial!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/2/2003 5:39:49 PM:MTGiga
There was a problem, it seems, when the tutorial was uploaded. In the grammar list, there should be <start> before every equal sign (=) and the top of the list should not be [], it should be []. Thank you!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/2/2003 6:03:38 PM:MTGiga
Ah! It did it again. In the brackets, there should be <start>, I do not know why this isn't working!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.