DCSIMG
COM Fun with Microsoft Agent - Pavel's Blog
Sign in | Join | Help

Pavel's Blog

Pavel is a software guy that is interested in almost everything
software related... way too much for too little time

COM Fun with Microsoft Agent

Whenever I teach COM interoperability in .NET, I try to show some nice demo for this. The classic is to use one of the Office applications (such as Word) to do some automation by creating a document, adding some text, etc. This is effective enough but not really fun.

A much more fun way is to use the Microsoft Agent technology. MS Agent is discontinued as far as further development is concerned, but it’s still fun and great for (at least) learning purposes.

What is MS Agent? Its most well known appearance (pun intended) was in the Office 2000 product suite, featuring the (in)famous “Clippy” that offered advise and allowed a somewhat “human” interaction with the application. Some users were fed up with Clippy and turned it off for good. Still, as a technology, it has its strong points. Other users swapped Clippy for another avatar, such as Merlin or Robbie.

Although MS Agent is now deprecated, and does not come preinstalled with Windows Vista and later, it can still be installed explicitly from the MS agent home page.

After installation, the required MS Agent COM DLL is AgentObjects.Dll and is located by default in the %SystemRoot%\msagent folder. Any characters you install appear in the Chars subdirectory (files with the ACS extension). Here’s how the Add Reference Dialog looks like:

image

One caveat to watch for is that MS Agent is 32 bit only, so any .NET project must be changed from “Any CPU” to “x86” (critical for 64 bit systems).

Initializing the MS agent server and loading a character can be done like so:

Agent _main;

IAgentCtlCharacterEx _merlin;

 

_main = new Agent();

_main.Connected = true;

_main.Characters.Load("merlin", "merlin.acs");

_merlin = _main.Characters["merlin"];

_merlin.Show(false);

_merlin.Play("Greet");

 

I’ve attached a sample project that demonstrates some of MS agent capabilities. It can also use a text to speech engine (must be SAPI 4.0 compliant) and even understand user speech.

Have fun!

Comments List

# re: COM Fun with Microsoft Agent

Published at Friday, February 25, 2011 4:07 PM by pavely  

You can get more avatars at http://www.msagentring.org/

Leave a Comment

(required) 
(
required
)
 
(optional)
(required) 

Enter the numbers above: