Sign in to follow this  
Followers 0
ericyip2007

Please help me to get IE Text

3 posts in this topic

I want to navigate to all the links in a web page and save the text. I Can not run the script below. Can you please tell me How can I do?

Code AutoIt

#include <IE.au3>

$target = InputBox("Save as Text", "enter file name:")

$target = @ScriptDir & "\" & $target

$sUrl = InputBox("Save to Text", "Enter URL:")

$file = FileOpen($target, 2)

$oIE = _IECreate($sUrl, 0, 1, 1)

$oLinks = _IELinkGetCollection($oIE)

$iNumLinks = @extended

For $oLink in $oLinks

_IENavigate($oIE, $oLink.href, 1)

If @error Then

MsgBox(0, "Error to netvigate!", @error)

Exit

EndIf

$sText = _IEBodyReadText ($oIE)

If @error Then

MsgBox(0, "get text error", @error & " " & @extended)

Exit

EndIf

FileWrite($file, $sText)

FileWrite($file, @CRLF)

Next

;_IEQuit($oIE)

FileClose($file)

MsgBox(0, "finish", "Opened " & $iNumLinks & " links.")

Exit

Share this post


Link to post
Share on other sites



hi

your code worked for me?

it follows links and writes text into file ..

add some more msgbox() to figure out what you get on what point..

do you use the latest version 3.22??

Share this post


Link to post
Share on other sites

Thank You. I am using autoit v3.2.2.0. Only can follow 1 link and the script break suddenly for no reason.

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