Jump to content
Sign in to follow this  
AzKay

Handling Errors

Recommended Posts

AzKay

$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- #

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
AzKay

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


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
AzKay

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

Share this post


Link to post
Share on other sites
AzKay

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

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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
Sign in to follow this  

×