ericyip2007 Posted February 7, 2007 Share Posted February 7, 2007 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 More sharing options...
nobbe Posted February 7, 2007 Share Posted February 7, 2007 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?? Link to comment Share on other sites More sharing options...
ericyip2007 Posted February 7, 2007 Author Share Posted February 7, 2007 Thank You. I am using autoit v3.2.2.0. Only can follow 1 link and the script break suddenly for no reason. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now