Skip to Content

PCQuest: A Personal Touch To Your Web Applications (MS Agent tutorial)

(Article Published in PC Quest, July 2000)

Coding an application with user assistants and character help systems that can take voice inputs and speak as well, may seem a nightmarish job for an independent programmer. But now, there's an easier answer to it. Microsoft Agent, which Microsoft defines as "ActiveX technology for interactive software agents" allows you to program interactive animated characters. Microsoft Agent runs as a COM server that can be programmed in COM-enabled languages such as Visual J++ and Visual C++, and also as an ActiveX control in languages such as Visual Basic, VBScript, JavaScript, etc, to make use of special interactive characters. These characters can take speech input using Microsoft Speech Input Engine, and give text-to-speech output using Lernout and Hauspie text-to-speech engine.

You can create these characters using Microsoft's Character Editor and Microsoft Linguistic Information Editor, which allow programming lip-synching with voice output, various gestures, and special sounds. Default characters can also be used, including Peedy the Parrot, Merlin the Wizard, Genie, and Robby the Robot.

The characters are comparable to Microsoft Office Assistant characters, but they aren't the same. Microsoft Agent characters are not limited to a specific type of application, and have voice input/output capability. They can also move on the screen, make gestures and actions on screen with sounds of their own, and use pre-recorded WAV files for speech. Microsoft Agent can be used for many applications such as interactive user interfaces to Web pages (due to scripting support) and GUI-based applications, story tellers, Web page reader applications, application interfaces for the disabled, e-mail notifiers and readers, help systems, chat avatars, and computer buddies.

The speech engines are adaptive, and as new voice recognition and speech input technologies come up, the same Agent application can easily be ported to a new speech platform, provided the latter is compatible with industry-standard speech API.

The characters are stored in separate ACF files. Microsoft Agent is a sort of patch to Windows, and Windows 2000 even ships Microsoft Agent by default. With a typical executable application using Microsoft Agent, Microsoft Agent setup and Lernout and Hauspie TTS engine setup are run separately as per licensing rules. The characters are a complement to the GUI interface and do not substitute it. Microsoft Speech Recognition is the only choice for voice input, while for text-to-speech output the choice could be between Microsoft and Lenout and Hauspie TTS engines.

Let's take a look at how you can program Agent in JScript or JavaScript.

Let's assume that you've downloaded and installed Microsoft Agent, and the Robby Character-whom this script calls Robby, and he says "Mera Bharat Mahan!". Comments in the source describe the code (see box).

More information, documentation, characters, Microsoft Agent API, and tools, are available at com/agent.

There are very few implementations of Microsoft Agent in the market today. One good and popular implementation is BonziBuddy-a computer companion using the Peedy character-at
<HTML><HEAD><TITLE>JScript/Javascript Sample</title></head> <body language="Javascript" onLoad="OnLoad()"> <H1>Microsoft Agent Sample-JScript</H1> <!- Updated to use Version 2.0 -> <!- The OBJECT tag defines Agent ActiveX control to the browser (and even automatically downloads Agent if not found), from your Website. -> <OBJECT ID=”AgentControl” width=0 height=0 CLASSID=”CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F” CODEBASE = “http:/your server/msagent.exe#VERSION=2,0,0,0”> </OBJECT> <!- This tag initializes Lernout and Hauspie TruVoice TTS engine for voice output -> <OBJECT ID=”TruVoice” width=0 height=0 CLASSID=”CLSID:B8F2846E-CE36-11D0-AC83-00C04FD97575" CODEBASE=”#VERSION=6,0,0,0"> </OBJECT> <SCRIPT language=JavaScript> var Robby; // a global variable to hold the character object function onLoad() { AgentControl.Connected = true; AgentControl.Characters.Load(“Robby”, “C:\\WINDOWS\\MSAGENT\\CHARS\\Robby.acs”); Robby = AgentControl.Characters.Character(“Robby”); Robby.LanguageID = 0x0409; // Loading Character, Putting reference to it in the variable, and initializing the // language as English Robby.Get(“state”, “Speaking, Reading”); Robby.Get(“animation”, “Greet, GreetReturn”); //Use the Get Method to preload all Actions and States to avoid delays in on-the-spot loading. Robby.Show(); //Show Character Robby.Get(“state”, “Hiding”); //Use the Speak Method to make the character Speak. Robby.Speak(“May raa Bhaa rut Muh haan!”); //Use the Play Method to make the character Perform animated actions, as defined in the character file. Robby.Play(“Decline”); Robby.Speak(“Hello there! I am Robby. I am very capable!”); Robby.Play(“Search”); Robby.Speak(“I can search in boxes”); Robby.Speak(“And I can Even do Magic!”); Robby.Play(“DoMagic2”); Robby.Speak(“And I can even Work out your Computer!”); Robby.Play(“Process”); Robby.Hide();//Hide Character } </SCRIPT> </body></html>

Akshat Singhal