Jump to content

_iebodyread* from current browser


Recommended Posts

I'm trying to read the body text/source from an open web browser, not create a new browser window with a specific url. I have read the material in the help file, but it always references something like:

$oIE = _IE_Example ("basic")

$sText = _IEBodyReadText ($oIE)

Where the _IEBodyReadText is looking at the variable $oIE, which is the "basic" part of _IE_Example. I just want to use an already open browser window, and tell _IEBodyRead* to look for a browser with a particular name in the title bar.

-mike

Link to comment
Share on other sites

CONGRATULATIONS

To Your First Post.

Your First Post 'lil Guy :) Welcome To The AutoIt Script Forums

------Good Luck With All Your Scripts.

Your First Post. CONGRATS!!!!

Not 100% Sure Of What Your Asking.

Edited by Swift
Link to comment
Share on other sites

I'm trying to read the body text/source from an open web browser, not create a new browser window with a specific url. I have read the material in the help file, but it always references something like:

$oIE = _IE_Example ("basic")

$sText = _IEBodyReadText ($oIE)

Where the _IEBodyReadText is looking at the variable $oIE, which is the "basic" part of _IE_Example. I just want to use an already open browser window, and tell _IEBodyRead* to look for a browser with a particular name in the title bar.

-mike

You need to get a pointer to the browser DOM object. That is usually called $oIE. To get the object from an already existing browser, use _IEAttach(), which is in the help file. Look at the examples in the help file under that function.

#include <IE.au3>

$oIE = _IEAttach("Some IE Browser Title", "Title")
$sHTML = _IEBodyReadHTML($oIE)
ConsoleWrite("Debug: $sHTML = " & $sHTML & @LF)

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You need to get a pointer to the browser DOM object. That is usually called $oIE. To get the object from an already existing browser, use _IEAttach(), which is in the help file. Look at the examples in the help file under that function.

#include <IE.au3>

$oIE = _IEAttach("Some IE Browser Title", "Title")
$sHTML = _IEBodyReadHTML($oIE)
ConsoleWrite("Debug: $sHTML = " & $sHTML & @LF)

:)

That's *exactly* what I wanted to do. Thanks for pointing that out. What I wanted to do is some more reliable way to detect the page being completely loaded, click on javascript links, and other general interaction with the page. This seems like it will do just that. Thanks for your help!
Link to comment
Share on other sites

Actually, that is what _IELoadWait is for...

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

I wanted to use _IEloadwait but I couldn't figure out how to tell autoIT to use an already open browser window. I'm still having trouble with it, using this code:

#include <IE.au3>

$oIE = _IEAttach ("Title of already open IE window")

$sHTML = _IEBodyReadHTML($oIE)

MsgBox(0, "Document Source", $sHTML)

I expect to get the body of the IE window printed to the MsgBox, but it just gives me a MsgBox with a 0 in it.

Link to comment
Share on other sites

I'll guess the top level document is a FRAMESET. Suggest you try DebugBar (see my sig) and look at _IEFrameGetObjByName.

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...