Teldin Posted April 19, 2007 Posted April 19, 2007 (edited) C:\PROGRA~1\AutoIt3\Include\IE.au3 (2659) : ==> The requested action with this object has failed.: $o_object.document.execCommand ("Refresh") $o_object.document^ ERROR Basically I have a timed script that opens a web page (after I log in) and ever 10 mins or so checks the site for changes. I get an error If I get logged out because while the object is still valid, the Refresh command fails as the specified page cannot be accessed. I dont mind any of this but my script crashes. I need to gracefully error and continue with my script. How can I do that? Here is some code: expandcollapse popup$Timer10 = TimerInit() ;portion of my main loop While 1 Sleep(50) If TimerDiff($Timer10) >= 600000 Then _Data1() Else EndIf Wend ;func I'm having problems with Func _Data1() GUICtrlSetData($status, "Checking news...") If IsObj($oIE2) Then _IEAction($oIE2, "refresh") If @error <> 0 Then ;I recently added this IF to try and error gracefully but it didn't work MsgBox(0, "ERROR", "You have been logged out") GUICtrlSetData($status, "ERROR: Not checking news") $stopie = 1 Else _IELoadWait($oIE2, 1000) $sText = _IEBodyReadText($oIE2) $ltrim = StringTrimLeft($sText, 115) $rtrim = StringTrimRight($ltrim, 301) If StringInStr($rtrim, "New") Or StringInStr($rtrimID, "New") Then GUICtrlSetData($status, "ERROR: News window lost") KillIE() Else EndIf Endif Else GUICtrlSetData($status, "ERROR: News window lost") $stopie = 1 EndIf GUICtrlSetData($status, "Ready...") EndFunc Any ideas? I dont have your _IEErrorHandler installed. Would that help at all? Edited April 19, 2007 by Teldin
Moderators big_daddy Posted April 19, 2007 Moderators Posted April 19, 2007 (edited) I dont have your _IEErrorHandler installed. Would that help at all?That is what it was made for. Just add this toward the top of your script. _IEErrorHandlerRegister() Edited April 19, 2007 by big_daddy
Teldin Posted April 19, 2007 Author Posted April 19, 2007 Ok let me try that. I was thinking it only helps finding problems and I alread know what the problem is.
Teldin Posted April 19, 2007 Author Posted April 19, 2007 Ok that seemed to work. It's not crashing now. Also returning the error as expected: --> IE.au3 Error from function _IELoadWait, $_IEStatus_InvalidObjectType --> IE.au3 Error from function _IEBodyReadText, $_IEStatus_InvalidObjectType (Expected document element) --> COM Error Encountered in test.au3 ----> $IEComErrorScriptline = 437 ----> $IEComErrorNumberHex = 80010108 ----> $IEComErrorNumber = -2147417848 ----> $IEComErrorWinDescription = The object invoked has disconnected from its clients. ----> $IEComErrorDescription = ----> $IEComErrorSource = ----> $IEComErrorHelpFile = ----> $IEComErrorHelpContext = ----> $IEComErrorLastDllError = 0 Thanks big daddy.
Teldin Posted April 19, 2007 Author Posted April 19, 2007 One last thing, can I change my "If @error <> 0 " to be able to catch the com error?
DaleHohm Posted April 19, 2007 Posted April 19, 2007 One last thing, can I change my "If @error <> 0 " to be able to catch the com error?Yes, @error get set to the global constant $_IEStatus_ComErrorAlso, look at the console output... all of those $IEComError* are global variables that you can examine the value of after a COM error.Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
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