Follow on from this question:
I am working on a Python 2.4 app which will run on Windows XP. It needs to be able to download various resources from HTTP and it's got to work in all of our office locations which use "PAC" files to automatically select http proxies.
Thanks to somebody who responded to my previous question I managed to find a technique to execute Javascript from within Python, it's really easy:
js = win32com.client.Dispatch('MSScriptControl.ScriptControl')
js.Language = 'JavaScript'
js.AddCode('function foo(a,b) {return a;}' )
result = js.Run( "foo", "hello" )
But here comes the problem:
The PAC file references a number of functions such as shExpMatch and isPlainHostName - these are presumably provided for free by Microsoft Internet Explorer. If I simply run the PAC file in Widnows Scripting using the recipe above it will fail because these functions are not missing.
So what I need is a way to set up the environment exactly the same way that IE does. The obvious way is to somehow import the functions in the same way that IE does.
I found that Firefox contains a single JS file which includes these functions, I suppose I could try to run Firefox's JS on Microsoft's scripting-host, but that sounds like a risky idea. What I really want is to make the javascript environment 100% Microsoft standard without anything that can make my life harder.
Any suggestions?
PS. You can see an example of a PAC file on Wikipedia. Unfortunately I cannot publish ours... that would violate company security.