Hello everyone, this is my first post here. I'm a relative novice in autoit and have only picked it up in the past month. Currently i'm working on a project at work to automate the downloading of a bank statement from the bank's website. The main problem that I'm having is doing error handling when an error happened because the website crashed / timeout. I'm trying to capture the error event when one of my _IE functions failed to load because the page is frozen. Here is a snippet of my code: Func Test()
Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
$WinHandle = WinGetHandle("Test Website")
$oIE = _IEAttach($WinHandle, "hwnd")
$oFrame = _IEFrameGetObjByName($oIE, "leftFrame")
$oDiv = _IEGetObjById($oFrame, "divFoldCont")
$oDiv2 = _IEGetObjById($oDiv, "divFold0")
$oDiv3 = _IEGetObjById($oDiv2,"divFoldSub0_1")
$oLinks = _IELinkClickByText($oDiv3, "Bank Statement")
Sleep(1000)
; Enter the Account Number
$oFrame = _IEFrameGetObjByName($oIE, "workspace")
$oLinks = _IELinkGetCollection($oFrame)
For $oLink in $oLinks
;ConsoleWrite($oLink.href)
_IEAction($oLink, "click")
sleep(1000)
ExitLoop
Next
EndFunc
Func _ErrFunc($oError)
$ErrorMessage = (@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
@TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
@TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
@TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
@TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
@TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
@TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
@TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
@TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
@TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc ;==>_ErrFuncI was planning for the program to send me an automated email to let me know that the program had crashed. This email will be triggered when an error event is captured. However here lies the problem. My script will always capture the following error message even when everything is working. The error message occur during _IEAttach. --> IE.au3 T3.0-2 Warning from function _IEAttach, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler) How do I modify my script so that this particular error won't trigger my error function? P.S I'm open to suggestions on any advice to improve on my script. P.S.S I can't use _IECreate because the website require me to login using a physical OTP, so I have to login to the website first before running the script. Thanks for any guidance