Approved: Fortect
Here are a few simple methods that should help solve the problem with automatic error handling.
Hello everyone, this private message is the first post here. I am new to Autoit and just picked it up last month. I am currently working on a project to automate the process of downloading a financial institution statement from a bank website. The real problem I’m having is preparing to troubleshoot when an error occurred due to a specific website crashing/timeout. I’m trying to catch the error event when one of them fails with my _IE functions because the page fill is stuck.
Approved: Fortect
Fortect is the world's most popular and effective PC repair tool. It is trusted by millions of people to keep their systems running fast, smooth, and error-free. With its simple user interface and powerful scanning engine, Fortect quickly finds and fixes a broad range of Windows problems - from system instability and security issues to memory management and performance bottlenecks.
FuncTest()Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")$WinHandle is equivalent to WinGetHandle("test site")$oIE = _IEAttach($WinHandle, "hwnd")$oFrame = _IEFrameGetObjByName($oIE, "leftFrame")$oDiv = _IEGetObjById($oFrame, "divFoldCont")$oDiv2 is equal to _IEGetObjById($oDiv, "divFold0")$oDiv3 = _IEGetObjById($oDiv2,"divFoldSub0_1")$oLinks = _IELinkClickByText($oDiv3, "Account Statement")Sleep mode (1000) BUT; Enter account number$oFrame = _IEFrameGetObjByName($oIE, "workspace")$oLinks = _IELinkGetCollection($oFrame) For $oLink $oLinksBUT; ConsoleWrite($oLink.href)_IEAction($oLink, "click")sleep (1000)Output cycle Nextradio endFunction _ErrFunc($oError)$ErrorMessage = (@ScriptName & cm ("& $oError.scriptline &"): : ==> COM error encountered!"&@CRLF&_@TAB & "err.number": & @TAB & @TAB & "0x" & Hex($oError.number) @CRLF & & _@TAB & "err.windescription:" & @TAB & $oError.win & @CRLF outline & _@TAB & "err.description: width in inches & @TAB & $oError.& description @CRLF & _@TAB & "err.source: & " @TAB & @TAB & $oError.source & @CRLF & _@TAB & "err.Is: help file" & @TAB & $oError.helpfile & @CRLF & _@TAB & "err.helpcontext: width in inches & @TAB & $oError.helpcontext & @CRLF & _@TAB & "err.lastdllerror is: & " @TAB & $oError.lastdllerror & @CRLF & _& @tab "err.scriptline became: " && @tab $oError.scriptline & @CRLF & _@TAB & "err.retcode: " @TAB & & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)EndFunc ;==>_ErrFunc
I was expecting the program type to automatically send me an email to let me know the process has failed. This email is issued when an error event is detected. However, therein lies the problem. My script can still catch the following error message if everything works. An error signal occurs during _IEAttach.
–> IE.au3 T3.0-2 Function Warning _IEAttach, Unable to register internal error, Unable to catch COM errors (use _IEErrorHandlerRegister() to register a custom error handler)
How do I change my script so that this particular error doesn’t trigger my error handling function?
P.S. I am open to suggestions to improve my script.
P.S.S. I can’t use _IECreate because I need to login to the site with a physical OTP, so I basically need to login to the site before running the script.
37 minutes ago jdelaney said:
Add an error handler. Sometimes, when the dom object is not available, when you try to get a child property or object, the script takes effect. _ieerrorhandlerregister, anyway.
I found this through a Google search and am experimenting with it. It should be enough that I select an empty function, right? Suppose I want to do nothing but ignore, see error. In theory my do-intil loop will do everything
EDIT: Closer, but no matter what text I try, I keep seeing in the console and the program crashes. But seems to at least catch this particular error
>”C:Program FilesAutoIt3SciTE..autoit3.exe” /ErrorStdOut “C:Scriptsxxx.au3”
–> IE.au3 T3.0-2 Launch from alert _IETableGetCollection, $_IESTATUS_NoMatch
–> Job IE.au3 T3.0-2 terminated due to error _IETableWriteToArray, $_IESTATUS_InvalidDataType
–> IE.au3 T3.0-2 Work will be done by warning _IETableGetCollection, $_IESTATUS_NoMatch
–> IE.au3 T3.0-2 Error rendering results _IETableWriteToArray, $_IESTATUS_InvalidDataType
–> IE.au3 T3.0-2 From warning clause _IETableGetCollection, $_IESTATUS_NoMatch
–> IE.au3 T3.0-2 Operational error $_IESTATUS_InvalidDataType
_ietablewritetoarray,