Jump to content
Sign in to follow this  
zhaicheng

How to ignore "error" to avoid collapsing

Recommended Posts

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")

$oHTTP.Send()

When connecting speed is bad,my code is having a problem- Action Faild,and then Autoit collaps.

Is there any way to avoid this error?

Maybe using if @error?How to use it?

Share this post


Link to post
Share on other sites

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")

$a=$oHTTP.Open("GET","http://kds.zj.com")

$oHTTP.Send()

$HTMLSource = $oHTTP.Responsetext

MsgBox(0,'',$HTMLSource)

Func MyErrFunc()

$HexNumber=hex($oMyError.number,8)

Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _

"Number is: " & $HexNumber & @CRLF & _

"Windescription is: " & $oMyError.windescription )

$_eventerror = 1

Endfunc

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...