[python-win32] MS Agent Event Handling via Python

=?GB2312?B?zsTB+g==?= wenstonezhong at gmail.com
Sun Jan 14 10:08:46 CET 2007


Hi,
 After searched a lot on web, not quit sure anybody met similar
problem before.

 When I try to track the event fired by MS Agent by using
'DispatchWithEvents', I thought may be this is because IAgentNotifySink
did not registered by server.
  I'm quite new to Python Com, it wrapped well, I wonder is there any
convient way to get IAgentNofiySink registered by Server?

 Any clue and hint are appreciated!
-----------------------------------------------------------------

  def TestMSAgent():
    class AgentEvents:
        def OnHide(self, CharacterID=defaultNamedNotOptArg,
Cause=defaultNamedNotOptArg):
            print "Hiding"
        def OnClick(self, CharacterID=defaultNamedNotOptArg,
Button=defaultNamedNotOptArg, Shift=defaultNamedNotOptArg,
x=defaultNamedNotOptArg, y=defaultNamedNotOptArg):
            print "Clicked"
    ag = DispatchWithEvents("Agent.Control", AgentEvents)
    ag.Characters.Load("robby",r"C:\WINDOWS\msagent\chars\robby.acs")
    robby = ag.Characters("robby")
    robby = WithEvents(robby, AgentEvents)
    robby.Show()
    while 1:
        time.sleep(0.2)

------------------------------------------------------------------
no any print after any clicking and hiding.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20070114/86c88702/attachment.htm 


More information about the Python-win32 mailing list