October 22, 2016
Hot Topics:

Beginning MS Agent

  • November 17, 2002
  • By Mack Male
  • Send Email »
  • More Articles »

So you're interested in having your own program Assistant? Excellent! Voice-enabled technologies such as Microsoft Agent are poised to be the next big thing. Imagine an animated character you can talk to on the dashboard of your car. The character would be able to give directions, vehicle information, and more! In this article, we'll look at how you can use Microsoft Agent in your applications, and how to load an Agent in Visual Basic.

First, make sure you have Microsoft Agent installed on your computer. If you need to download it, visit http://msdn.microsoft.com/workshop/ imedia/agent/agentdl.asp and download the core files, a text-to-speech engine and a voice recognition engine. For now, also download the Merlin character file. After doing this you are Agent ready!

Before we begin coding anything, let's look at where Microsoft Agent might be useful. Most computers run Windows, very much a keyboard-mouse operating system. Many people are accustomed to clicking. For this reason, your user interface should not consist of just Agent, but a combination of traditional GUI's and Agent. Also, you're better off to include some form of interaction with the characters besides voice.

The character you select is important too. Merlin, Genie and Robby are the three characters that ship with Microsoft Agent, however there are many other characters available on the Internet (msagentring.org). You can also create your own character using the Microsoft Agent Character Editor. It is important to match your character with the type of application you are creating. For example, an application for monitoring stocks would probably not work well with a Barbie-type character.

Now let's get started with Agent itself. After installed Microsoft Agent, your computer will be equipped with the Microsoft Agent ActiveX control. Start Visual Basic and create a new application. The next step is to add the Microsoft Agent control. Press CRTL-T, or click on the Project Menu and go to Components. After selecting the control, your toolbox should look similar to this:

Select the Agent button and draw it on your form. Your application can now use the Agent control! The default name for the control is "Agent1", so that's what we'll use here. Go to the Form_Load() procedure, and enter the following code:

Agent1.Characters.Load "Assistant", _
Set Assistant = Agent1.Characters("Assistant")

Before we go any further, lets take a look at what we just entered. The first line is pretty self-explanatory. This loads a character using the Agent control. Here I have used the name "Assistant". You can use any name you'd like. I have also chosen to use Merlin, a Microsoft -created character. The default directory for Windows 95/98 systems is used here ` C:\Windows\msagent\chars\ Of course, the directory will depend upon the location of the user's Windows directory and their Agent directory. We'll get into finding this folder in the next part.

The third line is for ease of use. By entering this line, we can now reference our character using just Assistant, as in Assistant.Speak. Otherwise, we'd have to enter Agent1.Characters("Assistant").Speak. Obviously, much longer.

Before testing the program, enter two more lines:

Assistant.Speak "Hello! I am Merlin."

We have now told the Agent control to play Merlin's Show animation, and once he is there, to say "Hello! I am Merlin." Run the program now to test it. You should have a screen similar to the following:

Congratulations! You have created your first application using Microsoft Agent! In the next part, we'll look at how to play animations, search for installed characters and directories, and more! By: Mack D. Male

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel