[python-win32] More IE jscript to Python com woes

Mark Hammond mhammond at skippinet.com.au
Fri Oct 15 00:17:35 CEST 2004


You will have to look up the documentation for GetInterfaceSafetyOptions -
the underlying issue is that your HTML code is trying to create a COM object
on the client, and IE will only do that for controls marked "safe for
scripting".

win32comext\axscript\client\*.py uses this IIRC, so may give you some
pointers.  Be careful you aren't making your clients vulnerable to some
attack basked on your object though.

Mark.

> -----Original Message-----
> From: python-win32-bounces at python.org
> [mailto:python-win32-bounces at python.org]On Behalf Of Craig H. Anderson
> Sent: Friday, 15 October 2004 6:29 AM
> To: python-win32 at python.org
> Subject: [python-win32] More IE jscript to Python com woes
>
>
> Thank you, Mark Hammond, your help is much appreciated.
> I got further this time, but still have problems.
>
> An error dialog pops up with this:
> A Runtime Error has occurred.
> Do you wish to Debug?
> Line: 24
> Error: Automation server can't create object
>
> In the Pythonwin trace window:
> Object with win32trace dispatcher created (object=None)
> ComGcsMosaixApp.__init__() 8
> in <ComGcsMosaixApp.ComGcsMosaixApp instance at
> 0x04583558>._InvokeEx_-GetInterfaceSafetyOptions(IID('{BB1A2AE
> 1-A4F9-11CF-8F
> 20-00805F2CD064}'),) [1,0,None]
>
> # My Python code
> from win32comext.axscript.client.framework import COMScript
>
> class ComGcsMosaixApp(COMScript):
>    _reg_progid_ = "GCSMosaix.app"
>    # use "print pythoncom.CreateGuid()"
>    _reg_clsid_ = "{C5A4B907-053E-4953-B20D-93DF6598CAE1}"
>    _public_attrs_ = ["Version","Dispo"]
>    _readonly_attrs_ = ["Version"]
>    def __init__(self):
>        COMScript.__init__(self)
>        self.dispoActive = 0
>        self.Version = "MyVersion"
>        self.Dispo = -1
>        print 'ComGcsMosaixApp.__init__() 8' # debug
>
> // jscript code on ASP page
> function onSend()
> {
>  var app = new ActiveXObject("GCSMosaix.app")
>  app.Dispo = 78
>  document.jscript.action.value="btnSendDispo"
>  document.jscript.submit()
> }
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32



More information about the Python-win32 mailing list