2000: A Win32 Oddisey

Pedro diazjimenez at ctv.es
Sat Sep 23 18:59:28 EDT 2000


thanks!!!!
thanks!!!!
thanks!!!!
thanks!!!!
thanks!!!!
thanks!!!!

;D
This is a VERY GOOD starting point

Cheers
    Pedro

----- Original Message -----
From: Michal Wallace <sabren at manifestation.com>
To: Pedro <diazjimenez at ctv.es>
Cc: <python-list at python.org>
Sent: Saturday, September 23, 2000 11:55 PM
Subject: RE: 2000: A Win32 Oddisey


> On Sat, 23 Sep 2000, Pedro wrote:
>
> > > I've never tried this... but... maybe you can use the IE browser
> > > component via COM?
> >
> > What module I have to import?. Was looking at the library ref. but found
> > nothing!
>
> you need the win32 extensions, for one thing..
> once you have them:
>
>   - open pythonwin
>   - load the "COM Makepy utility" under the Tools menu
>   - in the window that pops up, double click on:
>      "Microsoft Internet Controls"
>
> This generates a magical python module for you.. Now, in
> the python window, type:
>
> >>> from win32com.client import Dispatch
> >>> ie = Dispatch("InternetExplorer.Application")
> >>> ie.Visible = 1
>
> At this point, if things are going well, a browser will appear,
> but will have no content... So.. let's go someplace secure:
>
> >>> ie.Navigate("https://secure.authorize.net/")
>
> ... Well, it shows up in the browser... But how to get the
> text?
>
> In pythonwin, go to "Tools/COM Browser"
> "Registered Type Libraries"
>     "Microsoft Internet Controls"
>         "Type Library"
>             "InternetExplorer - CoClass"
>
>
> .. That didn't help...
>
> >>> ie
> <win32com.gen_py.Microsoft Internet Controls.IWebBrowser2>
>
> Ahh..
>
> "Tools/COM Browser"
>     "Registered Type Libraries"
>         "Microsoft Internet Controls"
>             "Type Library"
>                 "IWebBrowser2"
>
>
> Hmmm. That seems to show a bit more info, but we still don't
> know what to do with it.. Let's go to msdn and see if we can
> look that control up... Here it is:
>
>
http://msdn.microsoft.com/workshop/browser/webbrowser/reference/ifaces/IWebB
rowser2/IWebBrowser2.asp
>
>
> Looks like we want the "get Document" thing. Back to python.
>
> >>> ie.Document
> <COMObject Document>
>
> Cool!
>
> >>> doc = ie.Document
>
> According to the MSDN docs, this is just a normal DHTML document
> object..
>
> >>> doc.url
> 'https://secure.authorize.net/'
>
> >>> print doc.body.innerHTML
> [it works!]
>
> doesn't print the WHOLE HTML document, granted, just the body..  but
> you can basically script it as if it were client side DHTML because
> you're using the same engine. You may not need to grab it..
>
> Huh.
>
> Anyway, to get rid of it:
>
> >>> del doc
> >>> ie.Quit()
>
>
> Cheers,
>
> - Michal
> ------------------------------------------------------------------------
> www.manifestation.com  www.sabren.com  www.linkwatcher.com  www.zike.net
> ------------------------------------------------------------------------
>
>
> --
> http://www.python.org/mailman/listinfo/python-list
>




More information about the Python-list mailing list