Jump to content
Sign in to follow this  
MikeMotley

_iebodyread* from current browser

Recommended Posts

MikeMotley

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

Share this post


Link to post
Share on other sites
Swift

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

Share this post


Link to post
Share on other sites
Swift

your tring to read everything in a IE window?

if so...what are you doing with it? saving it as a .txt file?

HTML File?

==---SwiftY---==

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
MikeMotley

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!

Share this post


Link to post
Share on other sites
DaleHohm

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

Share this post


Link to post
Share on other sites
MikeMotley

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.

Share this post


Link to post
Share on other sites
DaleHohm

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.