# Hi
# I want to get events of FrontPage Web and Page object models with this code.
# OnPageNew and OnActivate works properly but when I click on the page nothing happen.
# I know that I want to get events of two different COM objects.
# But I don't know how can I do that.
# (I run this when FrontPage is active. Then I create a new page.)
# Thanks
from win32com.client import DispatchWithEvents
import time, pythoncom, msvcrt, types
class FrontPageEvents:
def __init__(self):
print 'FrontPageEvents'
def OnPageNew(self, page):
global t1, t2
t1=DispatchWithEvents(page, PageExEvents)
t2=DispatchWithEvents(fp.ActiveDocument, PageEvents)
print fp.ActiveDocument
class PageExEvents:
def __init__(self):
print 'PageExEvents'
def OnActivate(self):
print 'OnActivate'
class PageEvents:
def __init__(self):
print 'PageEvents'
def onclick(self):
print 'onclick'
t1=None
t2=None
fp=DispatchWithEvents("FrontPage.Application", FrontPageEvents)
while not msvcrt.kbhit():
pythoncom.PumpWaitingMessages()
time.sleep(.2)
msvcrt.getch()
_______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32