Internet Explorer, COM+, Javascript and Python

J Correia correiajREMOVECAPS at hotmail.com
Thu Apr 28 15:55:30 EDT 2005


"Roger Upole" <rupole at hotmail.com> wrote in message
news:4270c6ed$1_2 at 127.0.0.1...
> Something like this should be close:
>
> import win32com.client, pythoncom
> ie=win32com.client.Dispatch('internetexplorer.application')
> ie.Visible=1
> ie.Navigate('somepagewithjavascript.html')
> id=ie.Document.Script._oleobj_.GetIDsOfNames('somejsfunction')
> res=ie.Document.Script._oleobj_.Invoke(id, 0, pythoncom.DISPATCH_METHOD,
> True, <parameter or tuple of parameters> )
>
>    hth
>        Roger

Yes, that definitely works.  Only one minor correction:  it seems that to
pass multiple parameters you need to pass them sequentially seperated by
commas instead of in a tuple, i.e.
res=ie.Document.Script._oleobj_.Invoke(id, 0, pythoncom.DISPATCH_METHOD,
True, param1, param2, param3, ......... )

Useful test sitefor above code:
http://www.cpplab.com/Articles/JSCalls/TestPage/JSCallTestPage.htm

HTH,

>
>
> "Ishpeck" <ishpeck at gmail.com> wrote in message
> news:1114609311.916761.272980 at f14g2000cwb.googlegroups.com...
> >I need to make IE execute javascript in a web page with COM+ and
> > Python.
> >
> > Similarly to the way they do it in this article. . .
> >
> > http://www.codeproject.com/com/jscalls.asp
> >
>
>
>
> ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet
News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+
Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption
=----






More information about the Python-list mailing list