Jump to content

Please help me to get IE Text


Recommended Posts

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

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