Sign in to follow this  
Followers 0
JohnBailey

AutoIt Exit better way

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Nope when it chrash it chrash.. But you can supress errors and then run a function...


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

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  
Followers 0