PDA

Click to See Complete Forum and Search --> : [RESOLVED] Office Assistant - MSAgent?


Piglet
Mar 12th, 2006, 02:59 PM
Hello
I would like to create an office assistant within my VB program but I'm not quite sure where to start. I have read up about MsAgent but it doesnt clearly say what to do. I have added the MS Agent component and put one on my form but thats it so far! Any guidance will be appreciated!

Thanks
Amy

cssriraman
Mar 13th, 2006, 11:53 AM
Hi,

I attached a vb project about MS Agent control.

I believe this will be useful to you and will clarify your doubts on that.

Piglet
Mar 16th, 2006, 03:36 PM
OK i have managed to get some code working within a separate project but it doesnt run when i use it within my existing project. If i paste it into a new project and add the msagent controls it works fine but if i run it on a form within my current project it gives me the error "Invalid use of 'New' keyword". I have read lots of help files on this but cant seem to work it out. Can anybody help? Thanks in advance

Here is my code:


Option Explicit

Private WithEvents MsAgent As Agent
Private peedy As IAgentCtlCharacterEx

Private WithEvents MsAgent1 As Agent
Private merlin As IAgentCtlCharacterEx


Private Sub Form_Load()

Dim peedyRequest As IAgentCtlRequest
Dim merlinRequest As IAgentCtlRequest

'Create an Instance of the Agent Control
Set MsAgent = New Agent
Set MsAgent1 = New Agent
'Load the peedy Character
MsAgent.Characters.Load "peedy",

"c:\windows\msagent\chars\peedy.acs"
MsAgent1.Characters.Load "merlin",

"c:\windows\msagent\chars\merlin.acs"
Set peedy = MsAgent.Characters("peedy")
Set merlin = MsAgent1.Characters("merlin")
'Move the Character to the left
peedy.Left = 500
peedy.Top = 200
merlin.Left = 200
merlin.Top = 200
'Show peedy without playing the animation
' merlin.Show True
Set merlinRequest = merlin.Show

peedy.Wait merlinRequest

' peedy.Show True
Set peedyRequest = peedy.Show
merlin.Wait peedyRequest

merlin.Play "announce"
peedy.Play "Write"

Set merlinRequest = merlin.Speak("Hello Peedy. How are you?")
'Use bookmarks in the text to identify where peedy is
peedy.Wait merlinRequest

Set peedyRequest = peedy.Speak("Hi Merlin. I'm fine thanks")
'peedy.Speak ("\Mrk=1\I am now reading line number one. " & _
' "\Mrk=2\Now I am reading line two. " & _
' "\Mrk=3\And finally, I am reading line three.

\Mrk=4\ ")

merlin.Wait peedyRequest
Set merlinRequest = merlin.Speak("I think charley-anne got all

her questions right!")

peedy.Wait merlinRequest
peedy.Play "pleased"
peedy.Play "congratulate"

merlin.Play "congratulate"



End Sub