Jump to content

AutoIt Exit better way


Recommended Posts

Is there a better way to do this

Goal: There are files that AutoIt calls/adjusts that will occasionally cause AUI to "crash" and exit. Granted, ideally the script and the files should never let this happen. However, this has reached more curiosity and would be nice to have as precaution

My Method:

Opt("OnExitFunc","OnAutoItExit")

Global $success = 0
;do something
;if success then set
$success = 1

Func OnAutoItExit()
   If $success = 1 Then sendemail()
   Exit
EndFunc

Edit: Hit enter early

Edited by JohnBailey
A decision is a powerful thing
Link to comment
Share on other sites

Is there a better way to do this

Goal: There are files that AutoIt calls/adjusts that will occasionally cause AUI to "crash" and exit. Granted, ideally the script and the files should never let this happen. However, this has reached more curiosity and would be nice to have as precaution

My Method:

Opt("OnExitFunc","OnAutoItExit")

Global $success = 0
;do something
;if success then set
$success = 1

Func OnAutoItExit()
   If $success = 1 Then sendemail()
   Exit
EndFunc

Edit: Hit enter early

That won't even work.. When AutoIt crashes, it really does crash and doesn't jump to the OnAutoItExit function.. Just rewrite your program in a better fashioned way so that it won't crash. Edited by Manadar
Link to comment
Share on other sites

That won't even work.. When AutoIt crashes, it really does crash and doesn't jump to the OnAutoItExit function.. Just rewrite your program in a better fashioned way so that it won't crash.

granted. There are times were I'll use a class/UDF (eg yetAnotherExcelCOM and File) and pulls a file. If the file does not contain a given piece of information for those UDFs, AUI gives an error explaining where and pretty much why it happened. While yes I edit these and fix them to avoid these problems, I'd like to possibly eliminate it altogether. Like I said, I'm mostly just curious. There may be super cool things that AUI does that I don't know about (as I learn almost every time I'm on the forums or in the manual just reading around.

thanks

A decision is a powerful thing
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...