Jump to content

How to: get text from an 'Internet Explorer_Server' control


infest
 Share

Recommended Posts

Hi,

I am trying to automate ICQ messages reading.

The problem is that the text boxes are 'Internet Explorer_Server' controls.

Regular way to access the text don't work (like controlcommand, ControlGetText, etc)

I would be thankful for any help...=]

Link to comment
Share on other sites

_IEAttach (may need to use embedded mode) and _IEBodyReadText

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

_IEAttach (may need to use embedded mode) and _IEBodyReadText

Dale

The ICQ message window have at least two Internet Explorer_Server objects named: Internet Explorer_Server1 and Internet Explorer_Server2

your suggestion succeed referencing only one of them.

do you have an idea of how can i reference each one of them?

[ i used $myobj = _IEAttach ( "", "embedded" ) and it worked on one of the controls]

Thanks for the help.

Link to comment
Share on other sites

I think you could just put something in the first parameter that you left blank which would differentiate the two objects from one another, and change the mode the function is in if you need to. Right now it's just grabbing the first thing it sees, I think.

Link to comment
Share on other sites

The ICQ message window have at least two Internet Explorer_Server objects named: Internet Explorer_Server1 and Internet Explorer_Server2

your suggestion succeed referencing only one of them.

do you have an idea of how can i reference each one of them?

[ i used $myobj = _IEAttach ( "", "embedded" ) and it worked on one of the controls]

Thanks for the help.

OK. I've been meaning to do some testing in this area for some time and it turns out to be pretty simple. Here's a function that you can use to do this for now. Watch for this to make it in as an enhancement to _IEAttach in the future.

There is no error checking so you'll need to do an isObj test on the return value to insure you are getting a valid result.

$oIE1 = _AttachEmbedded("your-window-title", 1)

$oIE2 = _AttachEmbedded("your-window-title", 2)

; _AttachEmbedded
;       $s_string:      Title or hwnd of window containing control
;       $i_instance:    Enbedded instance to return (starting with 1)
;
;   Return value:       Object variable pointing to matched embedded instance
;
Func _AttachEmbedded($s_string, $i_instance)
    Local $iWinTitleMatchMode = Opt("WinTitleMatchMode")
    Opt("WinTitleMatchMode", 2)
    $h_result = ControlGetHandle($s_string, "", "Internet Explorer_Server" & $i_instance)
    $o_result = __IEControlGetObjFromHWND($h_result)
    Opt("WinTitleMatchMode", $iWinTitleMatchMode)
    Return $o_result
EndFunc

Dale

Edit: someone else was asking for this recently - I don't remember who -- I hope they are reading this...

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

OK. I've been meaning to do some testing in this area for some time and it turns out to be pretty simple. Here's a function that you can use to do this for now. Watch for this to make it in as an enhancement to _IEAttach in the future.

There is no error checking so you'll need to do an isObj test on the return value to insure you are getting a valid result.

$oIE1 = _AttachEmbedded("your-window-title", 1)

$oIE2 = _AttachEmbedded("your-window-title", 2)

; _AttachEmbedded
;       $s_string:      Title or hwnd of window containing control
;       $i_instance:    Enbedded instance to return (starting with 1)
;
;   Return value:       Object variable pointing to matched embedded instance
;
Func _AttachEmbedded($s_string, $i_instance)
    Local $iWinTitleMatchMode = Opt("WinTitleMatchMode")
    Opt("WinTitleMatchMode", 2)
    $h_result = ControlGetHandle($s_string, "", "Internet Explorer_Server" & $i_instance)
    $o_result = __IEControlGetObjFromHWND($h_result)
    Opt("WinTitleMatchMode", $iWinTitleMatchMode)
    Return $o_result
EndFunc

Dale

Edit: someone else was asking for this recently - I don't remember who -- I hope they are reading this...

CODE
#include <IE.au3>

; _AttachEmbedded

; $s_string: Title or hwnd of window containing control

; $i_instance: Enbedded instance to return (starting with 1)

;

; Return value: Object variable pointing to matched embedded instance

;

Func _AttachEmbedded($s_string, $i_instance)

Local $iWinTitleMatchMode = Opt("WinTitleMatchMode")

Opt("WinTitleMatchMode", 2)

$h_result = ControlGetHandle($s_string, "", "Internet Explorer_Server" & $i_instance)

$o_result = __IEControlGetObjFromHWND($h_result)

Opt("WinTitleMatchMode", $iWinTitleMatchMode)

Return $o_result

EndFunc

$objem1=_AttachEmbedded("userwindow", 1)

$objem2=_AttachEmbedded("userwindow", 2)

$mystr = _IEDocReadHTML ( $objem1 )

MsgBox(0, "docredhtml:", $mystr)

$mystr = _IEBodyReadText ( $objem1 )

MsgBox(0, "bodyreadtext:", $mystr)

$mystr = _IEDocReadHTML ( $objem2 )

MsgBox(0, "docredhtml:", $mystr)

$mystr = _IEBodyReadText ( $objem2 )

MsgBox(0, "bodyreadtext:", $mystr)

works excellent!!, i couldn't ask for better answer.

Thanks a lot.

infest

Link to comment
Share on other sites

  • 1 month later...

CODE
#include <IE.au3>

; _AttachEmbedded

; $s_string: Title or hwnd of window containing control

; $i_instance: Enbedded instance to return (starting with 1)

;

; Return value: Object variable pointing to matched embedded instance

;

Func _AttachEmbedded($s_string, $i_instance)

Local $iWinTitleMatchMode = Opt("WinTitleMatchMode")

Opt("WinTitleMatchMode", 2)

$h_result = ControlGetHandle($s_string, "", "Internet Explorer_Server" & $i_instance)

$o_result = __IEControlGetObjFromHWND($h_result)

Opt("WinTitleMatchMode", $iWinTitleMatchMode)

Return $o_result

EndFunc

$objem1=_AttachEmbedded("userwindow", 1)

$objem2=_AttachEmbedded("userwindow", 2)

$mystr = _IEDocReadHTML ( $objem1 )

MsgBox(0, "docredhtml:", $mystr)

$mystr = _IEBodyReadText ( $objem1 )

MsgBox(0, "bodyreadtext:", $mystr)

$mystr = _IEDocReadHTML ( $objem2 )

MsgBox(0, "docredhtml:", $mystr)

$mystr = _IEBodyReadText ( $objem2 )

MsgBox(0, "bodyreadtext:", $mystr)

works excellent!!, i couldn't ask for better answer.

Thanks a lot.

infest

Doesn't work with AutoIt 3.2.10.0!!!

Error in IE.au3

Link to comment
Share on other sites

Correct. A bug introduced in AutoIt DllCall in 3.2.10.0 has been reported and fixed in the next beta release. You'll need to wait for that or use 3.2.9.0 for now.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Also, what I've done for testing is that I've installed an early pre-3.2.10 beta and can then use Alt-F5 in SciTe to run a version of the interpreter where this still works untill the next release...

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

An enhancement to _IEAttach is included in IE.au3 V2.4-0 that has been submitted for the next beta post 3.2.10.0

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • 4 weeks later...

Please see the new syntax options for_IEAttach() in the 3.2.11.0 beta.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...