edgariyu 0 Posted March 26, 2011 Hi everyone!I would like to know how could i make not stop a script if something happens. I'm using the funcion:$WinHttpReq = ObjCreate("winhttp.winhttprequest.5.1") ;Realizamos la peticion HTTP $WinHttpReq.open("GET",$page) $WinHttpReq.send()and the problem i have is that if the page i'm opening is down or something goes wrong the script stops. I know that the answer is in a Object handler and it's something like:Global $g_eventerror = 0 $WinHttpReq = ObjCreate("winhttp.winhttprequest.5.1") ;Realizamos la peticion HTTP $WinHttpReq.open("GET",$page) if $g_eventerror = 1 then $WinHttpReq.send() else consolewrite("Error on page") endif Func MyErrFunc() local $HexNumber= hex($oMyError.number,8) If $HexNumber<> (80020009 or 80070005) Then ConsoleWrite("On Load error") $g_eventerror = 1 ; something to check for when this function returns EndIf Endfuncbut i'm missing something because i don't know how to get the concrete error number to handel the error. The function $WinHttpReq.send() sometimes gets an error (The requested action with this object has failed) and i don't know how to make the script not to stop. I've read the object page but still continue with doubts.Is there anyone with experience dealing with this objects reference that cound help me to solve this problem?Thanks a lot!! Share this post Link to post Share on other sites
AutoBert 197 Posted March 26, 2011 Have a look in the help file while ... wend / do ... until Share this post Link to post Share on other sites
trancexx 1,013 Posted March 26, 2011 Have a look in the help file while ... wend / do ... until You are over 13, right? @edgariyu, try something like this: ; Error object Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc") Func _ErrFunc() ; Nothing EndFunc ; Main code: Global $oWinHttpReq = ObjCreate("winhttp.winhttprequest.5.1") $oWinHttpReq.Open("GET", "http://something to cause error") $oWinHttpReq.Send() If $oError.number Then MsgBox(48, "Error", "Error sending request. Number is 0x" & Hex($oError.number, 8)) $oError.clear() EndIf ConsoleWrite("Still alive!" & @CRLF) ; ...whatever here... ♡♡♡ . eMyvnE Share this post Link to post Share on other sites
edgariyu 0 Posted March 27, 2011 Thanks for the answer! I'll try what you suggest Share this post Link to post Share on other sites