[python-win32] FrontPage COM Object Events
iman gowhari
igowhari at gmail.com
Fri Aug 18 20:50:54 CEST 2006
# 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()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20060818/01fc8fab/attachment.htm
More information about the Python-win32
mailing list