Jump to content

IE.au3 Help needed

Recommended Posts

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:

$Timer10 = TimerInit()

;portion of my main loop
While 1
    If TimerDiff($Timer10) >= 600000  Then

;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
            _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")
        GUICtrlSetData($status, "ERROR: News window lost")
        $stopie = 1
    GUICtrlSetData($status, "Ready...")

Any ideas?

I dont have your _IEErrorHandler installed. Would that help at all?

Edited by Teldin
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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_ComError

Also, look at the console output... all of those $IEComError* are global variables that you can examine the value of after a COM error.


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

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...