Sign in to follow this  
Followers 0
Alexxander

Inetread questiion

6 posts in this topic

hi all

im using inetread but it is getting me the source of the page , is their is a way to only get the text that a normal user see when he visit the site? i dont want the source code


Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Do you mean something like _IEBodyReadText? InetRead is for a file, not a site.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
JLogan3o13

 

it seems that _IEBodyReadText is only for getting text from already opened ie 

i want to get text from a site for example "facebook.com"

 

 when i use inetread("facebook.com") i get the source code of the page.

i want to get the text in that webpage 

"Connect with friends and thFind more of what you're looking for with Graph Search"


Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

InetRead returns the source of the page if its directed to it, the source after all is a file. unless you meant something else.

 

EDIT: here you go

#include <IE.au3>

$oIE = _IECreate("facebook.com")
$oText = _IEGetObjById($oIE, "pagelet_bluebar")
ConsoleWrite($oText.innertext & @CR)
Edited by Palestinian

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I personally only use it for reading files, have never simply pointed it at the URL to get source (silly me I use _INetGetSource for that). I would think the easiest way is with _IEBodyReadText, and make the window invisible if you want:

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IECreate("www.autoitscript.com", 0, 0)
Local $sText = _IEBodyReadText($oIE)
MsgBox($MB_SYSTEMMODAL, "Body Text", $sText)

_IEQuit($oIE)

I am sure someone much smarter than I will wander along, and may have another way of doing it.

 

Edit: Or if the window is already open:

#include <IE.au3>
#include <MsgBoxConstants.au3>
 
Local $oIE = _IEAttach("http://stevedonovan.github.io/winapi/api.html", "url", 1)
Local $sText = _IEBodyReadText($oIE)
MsgBox($MB_SYSTEMMODAL, "Body Text", $sText)
 
_IEQuit($oIE)
Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

_INetGetSource uses InetRead to return the source of the page, not so silly after all.

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  
Followers 0