List Info

Thread: Getting text from an ieWindow using GetText()




Getting text from an ieWindow using GetText()
user name
2007-06-25 18:54:52
Hello
I am having some trouble retrieving text with the GetText function of the IE activeX window
Passing LoadString some HTML works nicely, and displays in the window as expected.
Then I try to retrieve immediately using the GetText(True), and I get back som valid but empty html:
 &nbsp;  <p>;&nbsp;</p>
 
Can anyone give me some&nbsp;sample code on how to do this?
Also, if anyone has some sample code accing the ie DOM via wxPython, I'd love to see it.
 
Paul Wray


**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************

Re: Getting text from an ieWindow using GetText()
country flaguser name
United States
2007-06-26 13:36:21
Wray, Paul wrote:
> Hello
> I am having some trouble retrieving text with the
GetText function of 
> the IE activeX window
> Passing LoadString some HTML works nicely, and displays
in the window as 
> expected.
> Then I try to retrieve immediately using the
GetText(True), and I get 
> back som valid but empty html:
>     <p>&nbsp;</p>

It can't be done immediately because the text hasn't been
loaded yet. 
If you give the component time to load the string then it
will work 
fine.  For example I just did the following in the widget
inspection 
tool in the demo:

 >>> obj
<wx.lib.iewin.IEHtmlWindow; proxy of <Swig Object of
type 
'wxIEHtmlWindowBase *' at 0x2103530> >
 >>> obj.LoadString("wxPython"); print
obj.GetText(True)
True
<P>&nbsp;</P>
 >>>
 >>> obj.LoadString("<b>Hello</b>
World!")
True
 >>> obj.GetText(True)
u'<B>Hello</B> World!'


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java
give you jitters?  Relax with wxPython!


------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribelists.wxwidgets.org
For additional commands, e-mail: wxPython-users-helplists.wxwidgets.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )