Jump to content

IE Error Handling


Recommended Posts

I am trying to catch an error involving IE.au3 to keep autoIt.exe from exiting.

If I try to navigate to a webpage that I know doesn't exist I alway get

AutoIt Error Line 267 in IE.au3

$o_object.navigate($s_Url)

$o_object.navigate($s_Url)^Error

Error: The requested action with this object has failed.

Is there a way to catch this error and prevent the script from exiting?

I saw things like _IEErrorHandlerRegister and _IEErrorNotify in the help file, but I don't understand how they are used and If they even do what I want.

Link to comment
Share on other sites

I am trying to catch an error involving IE.au3 to keep autoIt.exe from exiting.

If I try to navigate to a webpage that I know doesn't exist I alway get

AutoIt Error Line 267 in IE.au3

$o_object.navigate($s_Url)

$o_object.navigate($s_Url)^Error

Error: The requested action with this object has failed.

Is there a way to catch this error and prevent the script from exiting?

I saw things like _IEErrorHandlerRegister and _IEErrorNotify in the help file, but I don't understand how they are used and If they even do what I want.

You didn't show code that causes the error. Post the shortest code snippet you can that generates that error.

But, in general, just putting _IEErrorHandlerRegister() near the top should prevent the error from being fatal, and show useful info in the SciTE console when errors occur.

When I run this, with an obviously bad URL, it doesn't crash:

#include <IE.au3>

$s_Url = "about:blank"
$oIE = _IECreate($s_Url)

$s_Url = "wwww.ggoooggllee.ccoomm"
_IENavigate($oIE, $s_Url)

:)

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

You didn't show code that causes the error. Post the shortest code snippet you can that generates that error.

But, in general, just putting _IEErrorHandlerRegister() near the top should prevent the error from being fatal, and show useful info in the SciTE console when errors occur.

When I run this, with an obviously bad URL, it doesn't crash:

#include <IE.au3>

$s_Url = "about:blank"
$oIE = _IECreate($s_Url)

$s_Url = "wwww.ggoooggllee.ccoomm"
_IENavigate($oIE, $s_Url)

:)

Thanks, adding _IEErrorHandlerRegister() fixed the problem.

The code that caused it to crash was

_IECreate("BadlyFormatedURL", 0, 1, 0)

Link to comment
Share on other sites

I don't expect taht to cause the script to fail no matter how badly the URL is formatted. I tried _IECreate("BadlyFormatedURL", 0, 1, 0) and did not see what you reported. Can you supply a reproducer as well as the console output from _IE_VersionInfo() ??

thanks,

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