Jump to content

Recommended Posts

Posted

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

Posted

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

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
×
×
  • Create New...