MS Agent - Looking For A Fun Challenge?

ghudson

Registered User.
Local time
Yesterday, 23:00
Joined
Jun 8, 2002
Messages
6,193
I am trying to use the Microsoft Agent "Merlin" in my Access 97 database. I can get the Merlin agent to work but only when I call a message box.

Microsoft Agent is already installed in most computer operating systems after Windows 98. You do not have to have the text to speech program installed for the agents to work for they can still speak in animated balloons.

Can you help me figure out how to get the Merlin agent to work (play a few animations and speak a few dialogs) without using a message box. I do now want the user to have to do anything to start or stop the animation for I want it to automatically play and end when I call it.

The attached file has a working version for you to see what the Merlin agent is all about. You can run the Merlin sub directly from the module. It is a pretty cool feature that Microsoft has hidden in most computers.

Thanks in advance for your help!
 

Attachments

You must load Merlin in a separate routine. Merlin's object variables must be global and remain in scope, otherwise the objects get deallocated when the procedure ends.

Code:
Dim objChar As IAgentCtlCharacter
Dim objAgent As Agent

Public Sub LoadEmUp()
    
    Set objAgent = New Agent 'CreateObject("Agent.Control.1")
    objAgent.Connected = True
    sName = "Merlin"
    objAgent.Characters.Load CharacterID:=sName, LoadKey:=sName & ".acs"
    Set objChar = objAgent.Characters(CharacterID:=sName)

End Sub

Sub Merlin3()
    
    Call LoadEmUp
    
    objChar.Show
    objChar.Speak "Hello!"
    objChar.Play "Wave"
    objChar.Speak ("My name is " & sName & ".")
    
    Beep
    objChar.MoveTo 340, 300
    objChar.Play "DoMagic1"
    objChar.Play "DoMagic2"
    
    objChar.Play "Explain"
    objChar.Speak "Can you help us figure out how to play the Merlin agent without using a message box?"
    
  ' objChar.Play "Processing"
    objChar.Hide
    'The agent will not play without this message box (with my code as is)
    'MsgBox "I can not figure out how to play Merlin without using a message box." & Chr(13) & Chr(13) & "I want the Merlin agent to play a few animations and speak a few dialogs and then disapear without any user action.", vbCritical, "Can you help?"
    
  '  Set objChar = Nothing
  '  Set objAgent = Nothing
    
    'Thanks in advance for your help and suggestions!
    
End Sub
 
Thanks pdx_man. I had discovered that site when I was searching on how to make the agent work. I just did not take the time to set it up properly. I got it working the way I want and must admit that I can have a lot of fun using the agent Merlin in my databases.

For the curious and for those of you who want to add something different to your databases, I suggest that you look at the working demo I have attached.

Most computer operating systems after Windows 98 should have the Merlin agent already installed. If not, you can find the links to download it and more within the notes in my modules.

For those of you with Access XP (2002), I am curious if the code converts and works okay if you convert my Access 97 sample to Access XP.

I included two different ways to run the Merlin agent in two different modules. Enjoy!
 

Attachments

msagent without message box?

I am wondering if you ever found a way to hide the message box while still allowing the agent to speak? It seems that there should be a way with 'objChar.Balloon.Visible = False', but that syntax doesn't work.

If not, do you know of another way to have access "speak" using text-to-speech without the agent?

Thanks,
Sup
 
This is an old posting you have dug up.

I got it to work without calling a message box but the "balloon" is visible and I never found a way to get the Merlin agent to work without the balloon.

There are a few samples posted somewhere in this forum on how to call the Merlin agent.
 
Hide the agent's balloon

ghudson,

Thanks for replying to this old thread. There are very few posts on this or any other Access forum regarding the agent or text-to-speech. It's a shame because it's a really fun way to spice things up.

I widened my search to everything MSAgent on the internet and I just found the answer. If you ever need to hide the balloon again, add this line to your playmerlin function:

objChar.Balloon.Style = False

Sup
 

Users who are viewing this thread

Back
Top Bottom