Jump to content

Anything like INetGetSource() that will return text and not html?


Recommended Posts

I was needing to get the text of a website through a program of mine. The HTML code makes my string searches a lot harder and if I could get the text instead it would simplify my code. I have tried a method (the 2nd code posted), but it runs a IE window in the background and takes a lot longer. I had to add the sleeps in there because it wanted to return an error sometimes. the _INetGetSource() seems really fast, but like I said I would like to return text instead. Do I have any other options? Thanks in advance.

$s_Text = _INetGetSource("http://www.autoitscript.com")

$o_object = ObjCreate("InternetExplorer.Application")
If IsObj($o_object) Then
$o_object.visible = 0
$o_object.navigate("http://www.autoitscript.com")
While $o_object.busy
Sleep(250)
WEnd
Sleep(500)
$s_Text = $o_object.document.body.innerText
$o_object.quit()
EndIf
Link to comment
Share on other sites

Try _InetReadBodyText()

Just make sure you add this at the top of your script:

#include <IfWishesWereDoughnutsIdWeighFiveHundredPounds.au3>

If that doesn't work, you could take a look at _IEBodyReadText() (still requires IE of course).

Dale

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

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