Sign in to follow this  
Followers 0
Iceburg

IE.au3 (3329) : ==> The requested action with this object has failed.:

6 posts in this topic

#1 ·  Posted (edited)

I have a script that I run in an infinite loop that is loading and changing IE Windows, sending out reports, sleeping, and doing it all again... I don't run it as a scheduled task as it performs functions throughout the whole day.

The whole script has links to all sorts of information that I don't need to post, but here is one example of how I am using IE, and the IELoadWait function.

;For Eric
$ToAddress = "...Eric's e-mail address removed..."                              ; destination address of the email - REQUIRED
ElseIf StringInStr(_IEPropertyGet($oIE, "innerhtml"), "String1") Then
            _IENavigate($oIE, "URL and string removed on purpose")
            _IELoadWait($oIE)
        ElseIf StringInStr(_IEPropertyGet($oIE, "innerhtml"), "String2") Then
            _IENavigate($oIE, "URL and string removed on purpose")
            _IELoadWait($oIE)
$body = StringRegExp(_IEBodyReadHTML ($oIE), '(\<STRONG\>' & $reportforEric & '\<\/STRONG\>(?s).*\d+\.\d+)', 1)
$error = @error;
ConsoleWrite($error & @CRLF)
if $error = 0 Then 
    _CreateMailItem()       ;send mail message if report is not blank.
EndIf

The script will work just fine for 5-8 days, and then error out (after 100+ iterations of running this same function, and sending the message) but occasionally it will error out with:

IE.au3 (3329) : ==> The requested action with this object has failed.:

I know its an issue with the IE.au3 include, or better yet my interaction with it.

I even also think its the IE on the computer that this is running on will occasionally fail and never finish loading the page... It will do the same on my laptop after a certain amount of time. I have read as much info as I could find, including the other posts that I could find on the forum regarding this message but nothing seems to point to an answer. I am not looking for a solution in the IE.au3 file, but some sort of error checking that I can do in my script that will keep it running. For example my thought is something like:

If IE not responding (whatever this looks like) then

_IEQuit($oIE)

runwait ("pskill.exe iexplore.exe")

endif

to keep it from failing but I can't figure out how to catch that error.

The other thing I have done is run a second script in a loop that checks for the first scripts process, but if the script errors then the second script doesn't catch it since the process is still running, but the error is on the screen. If I check for that error window it doesn't behave like a standard windows window and I can't control that error box.

Any help?

Here is another post I found that was close, but it looks like bad use of the functions from what I can tell, and Dave pointed out.

http://www.autoitscript.com/forum/index.php?showtopic=95011

Edited to clarify that the URL and String were removed on purpose.

Edited by Iceburg

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

In addition,

You can trap the error and cuase it to be non-fatal by using _IEErrorHandlerRegister(). @error will be set to a value specifying COM Error after it is triggered. See the helpfile.

The specific line number you show for the error is in _IEPropertyGet "innertext". Find the line in IE.au3 if the line number varies. This should help you narrow it down.

Dale

p.s. You can also use _IEErrorHandlerRegister() to set up your own error handler and have it exit, but give more diagnostics first

Edited by DaleHohm

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

Share this post


Link to post
Share on other sites

Took me a while to get back to this, I found that even if a AutoIt error comes up, since I can't close it by using AutoIt title references from another script, the process is still running as report.exe, so I have another script that exits the process once a day, clears IE cache, and then restarts the report.exe program. I am still occasionally getting the error and today am getting back to fixing it.

So, thanks for the responses. What I have implemented now in my script is the following, it seems too easy, so I was hoping Dave or someone could verify my use of the error handlers.

; INITIALIZE
_IEErrorHandlerRegister ("MyErrFunc")

I added the lower part to this function. OpenIE() will close IE, terminate any IE processes, and reopen IE with the page I need. There are several checks throughout the rest of the script that check the pages, stringregex, etc.

Func MyErrFunc()
    ; Important: the error object variable MUST be named $oIEErrorHandler
    $ErrorScriptline = $oIEErrorHandler.scriptline
    $ErrorNumber = $oIEErrorHandler.number
    $ErrorNumberHex = Hex($oIEErrorHandler.number, 8)
    $ErrorDescription = StringStripWS($oIEErrorHandler.description, 2)
    $ErrorWinDescription = StringStripWS($oIEErrorHandler.WinDescription, 2)
    $ErrorSource = $oIEErrorHandler.Source
    $ErrorHelpFile = $oIEErrorHandler.HelpFile
    $ErrorHelpContext = $oIEErrorHandler.HelpContext
    $ErrorLastDllError = $oIEErrorHandler.LastDllError
    $ErrorOutput = ""
    $ErrorOutput &= "--> COM Error Encountered in " & @ScriptName & @CR
    $ErrorOutput &= "----> $ErrorScriptline = " & $ErrorScriptline & @CR
    $ErrorOutput &= "----> $ErrorNumberHex = " & $ErrorNumberHex & @CR
    $ErrorOutput &= "----> $ErrorNumber = " & $ErrorNumber & @CR
    $ErrorOutput &= "----> $ErrorWinDescription = " & $ErrorWinDescription & @CR
    $ErrorOutput &= "----> $ErrorDescription = " & $ErrorDescription & @CR
    $ErrorOutput &= "----> $ErrorSource = " & $ErrorSource & @CR
    $ErrorOutput &= "----> $ErrorHelpFile = " & $ErrorHelpFile & @CR
    $ErrorOutput &= "----> $ErrorHelpContext = " & $ErrorHelpContext & @CR
    $ErrorOutput &= "----> $ErrorLastDllError = " & $ErrorLastDllError
    MsgBox(0,"COM Error", $ErrorOutput)
    SetError(1)
    Runwait ("c:\windows\pskill.exe iexplore.exe");
    sleep (150000)
    openIE()
    Return
EndFunc  ;==>MyErrFunc

So I guess my question is:

Was this implemented correctly, or am I not understanding the use of _IEErrorHandlerRegister? Is there a better way to do what I am trying to accomplish?

Share this post


Link to post
Share on other sites

Looks reasonable... but does it work the way you want it to?

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

Share this post


Link to post
Share on other sites

Minus the message box pop-up it worked exactly as I wanted, thank you so much Dave.

Share this post


Link to post
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
Sign in to follow this  
Followers 0