wisem2540 Posted February 6, 2018 Posted February 6, 2018 I am using $oTable = _IETableGetCollection($oIE, 1) in a loop every hour and writing data to a text file. Occasionally my script will error out with the following... It looks to me that it has an issue reading the table. So I basically just want to ignore the error and try again. Maybe a do-until makes sense? >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Scripts\Script.au3" "C:\Program Files\AutoIt3\Include\IE.au3" (1508) : ==> The requested action with this object has failed.: Case $iIndex > -1 And $iIndex < $oObject.document.GetElementsByTagName("table").length Case $iIndex > -1 A nd $iIndex < $oObject.document^ ERROR >Exit code: 1 Time: 83.41
Au3Builder Posted February 6, 2018 Posted February 6, 2018 (edited) $oTable = _IETableGetCollection($oIE, 1 ) If @error then ;do nothing else your part of a script. Edited February 6, 2018 by Au3Builder
wisem2540 Posted February 6, 2018 Author Posted February 6, 2018 (edited) I changed it to.... DO Sleep (500) Local $oTable = _IETableGetCollection($oIE, 1) Local $aTableData = _IETableWriteToArray($oTable) Until IsArray($atabledata) But I still feel like if that line in the Include errors out that it will throw an exception and stop the script EDIT: Yes indeed it does. For that reason, I do not think @error would solve this for me either Edited February 6, 2018 by wisem2540
AdamUL Posted February 6, 2018 Posted February 6, 2018 Since you said it is in a loop, the you can use ContinueLoop. $oTable = _IETableGetCollection($oIE, 1) If @error Then ContinueLoop Another way, is to check if $oTable is an Object. If Not IsObj($oTable) Then ContinueLoop Adam
Au3Builder Posted February 6, 2018 Posted February 6, 2018 (edited) I would try to reset Internet Explorer settings,first. https://support.microsoft.com/en-us/help/923737/how-to-reset-internet-explorer-settings Next add to your script to make sure every thing goes right. If @error or not IsArray($atabledata) then continue Loop Edited February 6, 2018 by Au3Builder
wisem2540 Posted February 6, 2018 Author Posted February 6, 2018 (edited) Guys, I am already using a do-until as noted (rather than contiueloop) and its still not functioning. I changed the script to a continuous loop with a brief pause for testing. It runs a few dozen times before erroring, so I do not think this is an IE settings issue. Since the error is happening inside the IE.au3 include, I believe these options are missing the mark. I remember building an error handling function some time ago, but I do not remember how I did it Edited February 6, 2018 by wisem2540
jdelaney Posted February 6, 2018 Posted February 6, 2018 Add in an error handler. sometimes the dom object is inaccessible, and then when you try to get a property or child object, the script will blow up. _ieerrorhandlerregister, or something like that. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Au3Builder Posted February 6, 2018 Posted February 6, 2018 there is a possibility that the ie library needs fixing.It's also hard to say what stops your script without testing the script yourself.I realize this is more like workaround than solution however it might do the job.You can spawn a bat script to constantly monitor if your app process is alive.If not,then runs compiled script once more.
jdelaney Posted February 6, 2018 Posted February 6, 2018 (edited) I agree. there should be error handling in the ie functions validating objects prior to diving into them. but the workaround is to turn on the COM error handler as I mentioned Edited February 6, 2018 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
wisem2540 Posted February 6, 2018 Author Posted February 6, 2018 (edited) 37 minutes ago, jdelaney said: Add in an error handler. sometimes the dom object is inaccessible, and then when you try to get a property or child object, the script will blow up. _ieerrorhandlerregister, or something like that. I did find this via a google search and I am experimenting with it now. It should be enough for me to just call an empty function right? Assuming that I wish to do nothing but ignore the error. In theory, my do-until loop would handle everything EDIT: Closer, but no matter what I try, I continue to see this in the console and the script crashes. But it seems to be capturing the error at least >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Scripts\xxx.au3" --> IE.au3 T3.0-2 Warning from function _IETableGetCollection, $_IESTATUS_NoMatch --> IE.au3 T3.0-2 Error from function _IETableWriteToArray, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Warning from function _IETableGetCollection, $_IESTATUS_NoMatch --> IE.au3 T3.0-2 Error from function _IETableWriteToArray, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Warning from function _IETableGetCollection, $_IESTATUS_NoMatch --> IE.au3 T3.0-2 Error from function _IETableWriteToArray, $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Warning from function _IETableGetCollection, $_IESTATUS_NoMatch --> IE.au3 T3.0-2 Error from function _IETableWriteToArray, $_IESTATUS_InvalidDataType >Exit code: 3221225477 Time: 253.5 Edited February 6, 2018 by wisem2540
Earthshine Posted February 6, 2018 Posted February 6, 2018 maybe the browser is busy refreshing or whatever it does in the background. maybe try monitor that process to see when cpu is idle for browser before automating? My resources are limited. You must ask the right questions
jdelaney Posted February 7, 2018 Posted February 7, 2018 (edited) Looks like it broke out of the loop. Are you sure the script didn't eventually find the table? Add in some consolewrite for debugging. Need to see the script to know for sure. Edited February 7, 2018 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now