June Kim schrieb: > IE's FireEvent works with a single argument, for example, > FireEvent("onKeyUp"). However, it doesn't work with two arguments : > FireEvent("onKeyUp",event). > > But It works without a problem with comtypes. > > See the following example to reproduce and compare: > > > file: c:/temp/javascripttest/onkeyup.html > > <html> > <head> > <title>onkeyup</title> > <script language="javascript"> > function showmeevent() { > document.getElementById("here").innerHTML+="[+] "+event.keyCode +"<br/>"; > document.lastKeyCode=event.keyCode; > } > </script> > </head> > </html> > <input id="inp" onkeyup="showmeevent()"/> > <div id="here"></div> > </body> > <body> > [...]
> > Now with comtypes: > >>>> from comtypes.client import CreateObject >>>> ie2=CreateObject("InternetExplorer.Application") >>>> ie2.Visible=True >>>> ie2.Navigate('c:/temp/javascripttest/onkeyup.html') > 0 >>>> e2=ie2.Document.CreateEventObject() >>>> e2.keyCode=65 >>>> ie2.Document.all.inp.FireEvent("onkeyup",e2) > True >>>> ie2.Document.lastKeyCode > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "C:\Python25\Lib\site-packages\comtypes\__init__.py", line 216, in > __geta > ttr__ > raise AttributeError(name) > AttributeError: lastKeyCode > > Accessing lastKeyCode from ie2.Document wasn't possible but the event > obejct is passed successfully -- I see 65 appended to the document. > I would guess that dynamically added attributes can only be accessed via the IDispatchEx interface. Does anybody know if it is possible to access these attributes with DispInvoke calls? comtypes does not (yet?) support IDispatchEx. Thomas _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32