Pages

Thursday, August 19, 2010

Microsoft Agent programming with Powerbuilder

According of wikipedia site, Microsoft Agent is a technology developed by Microsoft which employs animated characters, text-to-speech engines, and speech recognition software to enhance interaction with computer users. Thus it is an example of an embodied agent. It comes preinstalled as part of Microsoft Windows 2000 through Windows Vista (it is not part of Windows 7). Microsoft Agent functionality is exposed as an ActiveX control that can be used by web pages.

Before you can use the Agent in Powerbuilder, you need to download Microsoft Agent from Microsoft Agent site and install it into your computer. There 2 cores that you must download, one is Microsoft Agent core component, and the other is the Agent Character, which have 4 characters officially from Microsoft.

In this sample, I use Peedy, a green talking bird as a character

The next step is try to insert OLE Object at Powerbuilder's windows object. Choose the Microsoft Agent 2.0 from the Insert Control Tab.

Add Microsoft Agent Control 2.0 from the list

Agent OLE Object after inserted
In the Open event of window w_agent, type this script below:

//  set the agent, and named as Clippit
ole_1.Object.Characters.Load("Clippit","c:\windows\msagent\chars\peedy.acs")

// show the Clippit
ole_1.Object.Characters("Clippit").Show

// move the Clippit to position 400,200
ole_1.Object.Characters("Clippit").MoveTo(400,200)

// ask Clippit to play animation Greeting
ole_1.Object.Characters("Clippit").Play("Greet")

// ask Clippit to say something
ole_1.Object.Characters("Clippit").Speak("Hello World !!! I am Peedy !!! Called by Powerbuilder !!!")

If you have a speaker (and I bet you have), you can hear the voice speaking from Character.
Run the script, and you will get like this image


There's many build in functions in Agent character, and also many third party characters which you can find at Microsoft Agent's ring.

You can learn more about the functions and properties at Microsoft Agent official site, including the guidelines if you want to create your own character.

Of course, if you want to deploy your Powerbuilder applications with Microsoft Agent object, you also need to install Microsoft Agent cores at the PC Client.

1 comment:

  1. Gan, object Microsoft Agent Control 2.0 ini sumber nya dari mana?
    Dari ms office bukan?
    Ane pake ms office 2007 gak ada tuh..
    Apa ada installer khusus buat ms agent control tsb?
    Thanksss...

    ReplyDelete