[python-win32] MS Agent Event Handling via Python
Mark Hammond
mhammond at skippinet.com.au
Sun Jan 14 10:48:34 CET 2007
Try changing your idle loop from:
while 1:
time.sleep(0.2)
to:
while 1:
pythoncom.PumpWaitingMessages()
time.sleep(0.2)
(possibly importing pythoncom first).
Mark
-----Original Message-----
From: python-win32-bounces at python.org
[mailto:python-win32-bounces at python.org]On Behalf Of ÎÄÁú
Sent: Sunday, 14 January 2007 8:09 PM
To: python-win32 at python.org
Subject: [python-win32] MS Agent Event Handling via Python
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/f112c3dd/attachment.html
More information about the Python-win32
mailing list