Jump to content

Help with _IE Error


Recommended Posts

My script works just fine, until it hits a certain page, something wrong with the HTML on the page, but that is not really the point. I just want it to go on with the next line in the script if it encounters this error, but I tried using @error and other various things, but it still gets stuck and the script dies. If anyone has any ideas on how I could get this thing to just move on if it gets this error, that would be great.

Error

(29) : ==> The requested action with this object has failed.:
$a_links[$a_links_size] = $oLink.href
$a_links[$a_links_size] = $oLink.href^ ERROR

Full Code

#include <IE.au3>
#Include <string.au3>
Dim $x,$url,$count,$readurl,$y, $linecount,$oLinks,$iNumLinks,$oIE,$oLink,$delay

$linecount = 1
$delay = 0

HotKeySet("{F10}", "Terminate")

Do
    
$oIE = _IEAttach ("- Windows Internet Explorer", "WindowTitle")

$readurl = FileReadLine("backup_links.txt",$linecount)

_IENavigate($oIE, $readurl, 0)
_IELoadWait($oIE,1,5000)

$oLinks = _IELinkGetCollection($oIE)
$iNumLinks = @extended
Dim $a_links[1] = [0]

For $oLink In $oLinks
    $a_links_size = UBound($a_links)    
    ReDim $a_links[$a_links_size + 1]   
    $a_links[0] = $a_links_size
    $a_links[$a_links_size] = $oLink.href
Next

For $x = 1 To $a_links[0]
    If StringInStr($a_links[$x], "@") Then 
        $bet = _StringBetween($a_links[$x],"mailto:","?")
        FileWrite("email.txt",$bet[0] & @CRLF)
    EndIf
Next

$linecount += 1

Until $linecount = 51406

Func Terminate()
    Exit 0
EndFunc
Link to comment
Share on other sites

Try adding _IEErrorHandlerRegister() to the top of your script to get more info.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

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