Jump to content

Bug in IE.au3?


Recommended Posts

#include<IE.au3>
#include<Process.au3>
opt("WinTitleMatchMode",2)
_RunDOS("start www.google.com")
WinWaitActive("Internet")
$newwin = WinGetHandle("","")
$oIE2 = _IEAttach($newwin,"HWND")
If @error then msgbox(0,"",@error & "    "& @extended)
msgbox(0,"","SUCCESS?????")
$oIE2.visible = 0

Func onautoitexit()
    _IEQuit($oie2)
EndFunc

What am i doing wrong to fatally crash with the error:

:\Program Files\AutoIt3\Include\IE.au3 (3018) : ==> The requested action with this object has failed.:

Return HWnd($o_object.HWnd())

Return HWnd($o_object.HWnd()^ ERROR

I can't see any errors on my part, so maybe a bug in IE.au3?

Edited by EvAsion
Link to comment
Share on other sites

#include<IE.au3>
#include<Process.au3>
opt("WinTitleMatchMode",2)
_RunDOS("start www.google.com")
WinWaitActive("Internet")
$newwin = WinGetHandle("","")
$oIE2 = _IEAttach($newwin,"HWND")
If @error then msgbox(0,"",@error & "    "& @extended)
msgbox(0,"","SUCCESS?????")
$oIE2.visible = 0

Func onautoitexit()
    _IEQuit($oie2)
EndFunc

What am i doing wrong to fatally crash with the error:

:\Program Files\AutoIt3\Include\IE.au3 (3018) : ==> The requested action with this object has failed.:

Return HWnd($o_object.HWnd())

Return HWnd($o_object.HWnd()^ ERROR

I can't see any errors on my part, so maybe a bug in IE.au3?

You're using a global variable in your onautoitexit() that hasn't been set with an IE Object. It's not IE.au3...it's PEBKAC.

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Could be a PICNIC issue... :)

All seriousness aside, $newwin is probably being set to the wrong handle.

Why not just use _IECreate(www.google.com, 1, 0)?

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

The only way I can see to get this error is that there is a window open that appears to be a browser that really isn't. This iis in code that loops through the Shell.Application collection (includes IE and windows Explorer and variants). I currently check to see if window.Type and window.document.title are valid properties -- if they are, I assume we have an IE window and move blindly on, else I skip them.

It is possible that you have some sort of exotic application running that is hosted in a shell window, has a type and document.title property but has no .hwnd property. Can you shed any light on this?

You should also be able to move past the error by using _IEErrorHandlerRegister()

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

The only way I can see to get this error is that there is a window open that appears to be a browser that really isn't. This iis in code that loops through the Shell.Application collection (includes IE and windows Explorer and variants). I currently check to see if window.Type and window.document.title are valid properties -- if they are, I assume we have an IE window and move blindly on, else I skip them.

It is possible that you have some sort of exotic application running that is hosted in a shell window, has a type and document.title property but has no .hwnd property. Can you shed any light on this?

You should also be able to move past the error by using _IEErrorHandlerRegister()

Dale

Well I tested on my old computer just reformatted.. still the same errror.

The Hex error number returned by IEErrorHandlerRegister() is 80020009 which is "The object referenced by the application no longer points to a valid object." if i'm not mistaken.

So i guess its safe to assume that it is finding another window that has valid window.Type and window.document.title properties that is immediately closing before the function can complete?

p.s. does this actually work for anyone?

#include<IE.au3>
#include<Process.au3>
_IEErrorHandlerRegister ("MyErrFunc")
opt("WinTitleMatchMode",2)
_RunDOS("start www.google.com")
WinWaitActive("Internet")
$newwin = WinGetHandle("","")
WinSetTitle($newwin,"","TEST HANDLE")
$oIE2 = _IEAttach($newwin,"HWND")
If @error then msgbox(0,"",@error & "    "& @extended)
msgbox(0,"","SUCCESS?????")
$oIE2.visible = 0

Func onautoitexit()
    If IsDeclared("oie2") Then _IEQuit($oie2)
EndFunc

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)
    Return
EndFunc  ;==>MyErrFunc

Edit: $newwin returns the correct handle

Edited by EvAsion
Link to comment
Share on other sites

Your previous code worked for me... Another explanation is taht it is finding a valid browser window that gets deleted in the milliseconds between lines of code in _IEAttach.

Are you running Vista by chance?

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

There is a discussion here: http://www.autoitscript.com/forum/index.ph...20&hl=vista

New security in Windows Vista causes a new browser window to be created when a browser is instructed to navigate to a URL in a different security zone. This occurs as well with the initial creation and navigation initiated with _IECreate. The new window is a new browser instance and the previous browser object variable no longer points to it.

There are several workarounds:

Note: IE8 has fixed this "bug". The old, desired behavior is restored!

  • Upgrade to IE8 -- they finally fixed this issue. For earlier versions...
  • add #RequireAdmin to your code (this is required even if the account is part of the Administrator's Group and will propmt for credentials if necessary),
  • use _IEAttach to connect to the new browser window
  • add the target website to the Trusted Sites security zone in IE,
  • turn off "Protected Mode" in IE, or
  • disable UAC.
Care must be taken to understand the implications of disabling IE security features when accessing untrusted sites.

Very frustrating issue.

Dale

Edit: added #RequireAdmin

Note: issues are documented in the helpfile for 3.2.12.x in the related function documentation

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

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

just because you cant work with it, doesnt mean it sucks..

for me, i never want back to XP ever.

Valid or not, dropping your opinion into a dormant thread is not a good idea.

Hopefully everyone ignores this, but the only other possible outcome is starting yet another debate about the merits of Vista/XP and there are plenty of other places you can participate in one of those.

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...