Jump to content

Embedded MSAgent Object


Recommended Posts

I've been messing with this for a couple of days now and it seems that the agent characters can't be embedded in a GUI. Has anyone found a way around this yet or do I just write off the idea? I'm also wondering if there might be a method using DLL calls.

Here is some code I tried and you will see there are two problems, First the positioning and secondly, closing the GUI doesn't immediately close the character

$Frm_Main = GUICreate("TestGUI")
GUISetBkColor(0x003399)
$Agent = "Agent.Control.2"
If IsObj($Agent) Then
   $Agent = ObjGet("",$Agent)
Else
   $Agent = ObjCreate($Agent)
EndIf
$Agent.Connected = 1
$aEmbedded = GUICtrlCreateObj($Agent, 10, 10, 60, 60)
;$aPos = WinGetPos($Frm_Main)
$Agent.Characters.Load ("Rover",@WindowsDir & "\Msagent\Chars\rover.acs")
$A_Chr = $Agent.Characters.Character("Rover")
;$A_Chr.MoveTo ($aPos[0]+10,$aPos[1] +30)
$A_Chr.Show()
$A_Chr.Play("Thinking")
GUISetState()

While 1
   If GUIGetMsg() = -3 Then
      $A_Chr.Hide()
      MsgBox(0, "Test", $A_Chr.stop)
      $Agent.Connected = 0
      $Agent = ""
      ExitLoop
   EndIf
Wend

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

You can use this to close the character: $Agent.Characters.Unload('rover'), I prefer 'merlin' by the way. I don't understand what is the problem with the positioning. Do you mean that moving the GUI window around won't move the character with it, so it's not truly embedded?

Link to comment
Share on other sites

You can use this to close the character: $Agent.Characters.Unload('rover'), I prefer 'merlin' by the way. I don't understand what is the problem with the positioning. Do you mean that moving the GUI window around won't move the character with it, so it's not truly embedded?

Actually I used rover to test with. It will probably be a custom character in the end. And yes, as far as I can tell the character is not embedded at all. I can still drag it any place on the desktop and it doesn't even open inside the GUI obj control. I have a hunch it can't be done. I've even thought of creating it on an html page and then embedding that using Shell.application.2

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...