Jump to content

$oIEErrorHandler^ERROR


Recommended Posts

Does anyone know why I'm getting error while running this script? This script should close new opened window in IE and it does but then I'm getting this error:

$IEComErrorScrptline = $oIEErrorHandler.scriptline

$IEComErrorScrptline = $oIEErrorHandler^ERROR

Error: Variable must be of type "Object".

#include <IE.au3>

Const $navOpenInNewWindow = 0x1

$oIE1 = _IECreate("http://www.autoitscript.com/autoit3/")
$oEvent = ObjEvent($oIE1, "IEEvent_", "DWebBrowserEvents")
__IENavigate($oIE1, "http://www.autoitscript.com/autoit3/downloads.shtml", 1, $navOpenInNewWindow)

While 1
    Sleep(5000)
WEnd

Func IEEvent_NewWindow($Url, $Cancel)
    $oIE2 = _IEAttach($Url, "URL")
    While @error
        $oIE2 = _IEAttach($Url, "URL")
    WEnd
    _IEQuit($oIE2)
EndFunc
Edited by grzesiek
Link to comment
Share on other sites

This is nasty. Sorry. _IEAttach instantiates a COM error handler that is not tolerant of asynchronous entry like this.

I suggest you avoid the issue by using NewWindow2 or NewWindow3 events that both pass an object reference to the new browser window instead of using _IEAttach to get it indirectly.

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

Link to comment
Share on other sites

I haven't done it, just read about it. Please show what you tried.

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

Link to comment
Share on other sites

I changed script to this and it doesn't work. Message box should appear when second window is about to open but it doesn't.

#include <IE.au3>

Const $navOpenInNewWindow = 0x1

$oIE = _IECreate("http://www.autoitscript.com/autoit3/")
$oEvent = ObjEvent($oIE, "IEEvent_", "DWebBrowserEvents2")
__IENavigate($oIE, "http://www.autoitscript.com/autoit3/downloads.shtml", 1, $navOpenInNewWindow)

Func IEEvent_NewWindow2($ppDisp, $Cancel)
    MsgBox(0,"","")
EndFunc

I also tried this:

Const $navOpenInNewWindow = 0x1

$oIE = ObjCreate("InternetExplorer.Application")
$oEvent = ObjEvent($oIE, "IEEvent_", "DWebBrowserEvents2")
$oIE.Visible = True
$oIE.Navigate("http://www.autoitscript.com/autoit3/")
While $oIE.Busy = True
    Sleep(500)
WEnd
$oIE.Navigate("http://www.autoitscript.com/autoit3/downloads.shtml", $navOpenInNewWindow)

Func IEEvent_NewWindow2($ppDisp, $Cancel)
    MsgBox(0,"","")
EndFunc
Edited by grzesiek
Link to comment
Share on other sites

You're right. The NewWindow2 and NewWindow3 events are either not firing or are not being trapped. I cannot explain it.

As a workaround, it appears taht if you add _IEErrorHandlerRegister() to your script, you will no longer encounter a fatal error and your script can continue.

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

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
 Share

  • Recently Browsing   0 members

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