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 |
1: // set the agent, and named as Clippit
2: ole_1.Object.Characters.Load("Clippit","c:\windows\msagent\chars\peedy.acs")
3:
4: // show the Clippit
5: ole_1.Object.Characters("Clippit").Show
6:
7: // move the Clippit to position 400,200
8: ole_1.Object.Characters("Clippit").MoveTo(400,200)
9:
10: // ask Clippit to play animation Greeting
11: ole_1.Object.Characters("Clippit").Play("Greet")
12:
13: // ask Clippit to say something
14: 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.
No comments:
Post a Comment