Internet Explorer, COM+, Javascript and Python


Ad

Advertisements

R

Roger Upole

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
 
J

J Correia

Roger Upole said:
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,
=----
 
Ad

Advertisements

P

Peter Hansen

dannyguindi said:
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
 

Top