469,622 Members | 2,159 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,622 developers. It's quick & easy.

Internet Explorer, COM+, Javascript and Python

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

Jul 19 '05 #1
4 2937
Something like this should be close:

import win32com.client, pythoncom
ie=win32com.client.Dispatch('internetexplorer.appl ication')
ie.Visible=1
ie.Navigate('somepagewithjavascript.html')
id=ie.Document.Script._oleobj_.GetIDsOfNames('some jsfunction')
res=ie.Document.Script._oleobj_.Invoke(id, 0, pythoncom.DISPATCH_METHOD,
True, <parameter or tuple of parameters> )

hth
Roger
"Ishpeck" <is*****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.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 =----
Jul 19 '05 #2

"Roger Upole" <ru****@hotmail.com> wrote in message
news:42**********@127.0.0.1...
Something like this should be close:

import win32com.client, pythoncom
ie=win32com.client.Dispatch('internetexplorer.appl ication')
ie.Visible=1
ie.Navigate('somepagewithjavascript.html')
id=ie.Document.Script._oleobj_.GetIDsOfNames('some jsfunction')
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/JSCal...llTestPage.htm

HTH,


"Ishpeck" <is*****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.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

=----

Jul 19 '05 #3
Do you guys know if there is a way to do this in Linux?
Thanks.

Danny

Jul 19 '05 #4
dannyguindi wrote:
Do you guys know if there is a way to do this in Linux?


What is "this"? Your subject line provides a context, but not a problem
to which we can give you the solution. Please be specific.

-Peter
Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Apu Nahasapeemapetilon | last post: by
11 posts views Thread by Doug van Vianen | last post: by
26 posts views Thread by Prisoner at War | last post: by
1 post views Thread by avpkills2002 | last post: by
2 posts views Thread by swethak | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.