Jump to content

Handling Errors


Recommended Posts

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "http://11234u234")
$oHTTP.Send()

If you run that, it will error.

How would I have it to, not show the error, but keep running the script?

Ive tryed using: $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

But it doesnt work for people without autoit installed.

Any ideas?

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

  • Developers

Ive tryed using: $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

But it doesnt work for people without autoit installed.

Any ideas?

Don't think so...

What to the need for installing AutoIt3 when you run a compiled version of a script?

Why did you draw that conclusion ?

:)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Because the compiled script, doesnt seem to include the AutoIt.Error.

BZZZZZZzzzt! Wrong.

The following script runs and exits without errors when compiled and then run on a machine without AutoIt installed. Tested on XP Pro, and server 2003:

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Install a custom error handler

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open ("GET", "http://abc123abc123")
$oHTTP.Send()

; This is my custom error handler
Func MyErrFunc()
    ; Do nothing, 'cause AzKay sez so...
    SetError(1) ; something to check for when this function returns
EndFunc   ;==>MyErrFunc

The only thing left would be a funky issue with Windows version - what version are you running it on?

:)

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

I dont want the error to show up atall.

The error function being,

Func MyErrorFunc

EndFunc

It works for me, But doesnt seem to work for other people who dont have autoit installed.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

BZZZZZZzzzt! Wrong.

The following script runs and exits without errors when compiled and then run on a machine without AutoIt installed. Tested on XP Pro, and server 2003:

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Install a custom error handler

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open ("GET", "http://abc123abc123")
$oHTTP.Send()

; This is my custom error handler
Func MyErrFunc()
    ; Do nothing, 'cause AzKay sez so...
    SetError(1) ; something to check for when this function returns
EndFunc   ;==>MyErrFunc

The only thing left would be a funky issue with Windows version - what version are you running it on?

:)

This is just what ive been doing. But it doesnt seem to work for other people, they still get an error popping up.
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

  • Developers

This is just what ive been doing. But it doesnt seem to work for other people, they still get an error popping up.

You have yet to tell us what the error is and on which line it is.

Maybe test to make sure that $oHTTP is an object would help ?

:)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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