Jump to content

IE.au3: 'Object referenced outside a "With" statement' when searching for frame and site is down


Recommended Posts

The script:

#include <IE.au3>

_IEErrorHandlerRegister()

$oIE = _IEAttach("http://www.google.com", "URL")

$oFrame = _IEFrameGetObjByName($oIE, "frame_that_doesnt_exist")

MsgBox("","",@error)

If I have an explorer window open to the google front page and I run this script then I can see the @error being set to 7 (no frames found) which is just as expected.

However if I block google so the page wont load (for example if I setup IE6 to use a nonexistent proxy server), refresh explorer (getting

The page you are looking for is currently unavailable. The Web site might be experiencing technical difficulties, or you may need to adjust your browser settings page) and run the script it generates the following:

>Running:(3.3.6.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Administrator\Desktop\Dev\DASC\test.au3"    
--> COM Error Encountered in test.au3
----> $IEComErrorScriptline = 713
----> $IEComErrorNumberHex = 80020009
----> $IEComErrorNumber = -2147352567
----> $IEComErrorWinDescription = Access is denied.
----> $IEComErrorDescription = Access is denied.
----> $IEComErrorSource = 
----> $IEComErrorHelpFile = C:\WINDOWS\system32\Mshtml.hlp
----> $IEComErrorHelpContext = 0
----> $IEComErrorLastDllError = 0

--> COM Error Encountered in test.au3
----> $IEComErrorScriptline = 2214
----> $IEComErrorNumberHex = 80020009
----> $IEComErrorNumber = -2147352567
----> $IEComErrorWinDescription = Access is denied.
----> $IEComErrorDescription = Access is denied.
----> $IEComErrorSource = 
----> $IEComErrorHelpFile = C:\WINDOWS\system32\Mshtml.hlp
----> $IEComErrorHelpContext = 0
----> $IEComErrorLastDllError = 0

C:\Program Files\AutoIt3\Include\IE.au3 (2257) : ==> Object referenced outside a "With" statement.:
Return SetError($_IEStatus_Success, $oTemp.GetElementsByTagName($s_TagName).length, $oTemp.GetElementsByTagName($s_TagName))
Return SetError($_IEStatus_Success, $oTemp.GetElementsByTagName($s_TagName)^ ERROR
->15:28:33 AutoIT3.exe ended.rc:1
>Exit code: 1    Time: 1.761

I am completely mystified as to why this script generates a fatal error when trying to find a frame on a web page if that page is unavailable, am I missing something?

Edited by mistermassacre
Link to comment
Share on other sites

Ah, you caught me making a mistake I correct here in the forum all of the time...

Line 800 is currently

If $oFrame.name = $s_Name Then Return SetError($_IEStatus_Success, 0, $oTemp.frames($s_Name))

and needs to be

If String($oFrame.name) = $s_Name Then Return SetError($_IEStatus_Success, 0, $oTemp.frames($s_Name))

You can update your copy if you like for now and I'll get the fix in the pipeline.

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