Jump to content
Sign in to follow this  
CyberSlug

OnAutoItExit question

Recommended Posts

I've noticed that OnAutoItExit is still called for certain types of script crashes....

I'm not complaining; I'm just wondering what types of errors are "more fatal" (if there is such a thing :))

Debug message prints:

$foo;ERROR:  Exppected a "=" operator in assignment statement

Func OnAutoItExit()
    MsgBox(4096,"DEBUG","Debug")
EndFunc

Debug message does not print:

foo;ERROR:  Unknown function name

Func OnAutoItExit()
    MsgBox(4096,"DEBUG","Debug")
EndFunc
Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

IMO, it should NOT be called on an AutoIt error. There is no guarantee that the state of AutoIt will be "safe" so it should not be called on any type of error event.

The only times it should be called are:

  • When the Exit keyword is used.
  • When the script runs to completion.
  • When the Exit menu item is selected from the icon.
The only other situations I can think of in which a script can exit are:
  • The program is aborted abnormally (via Task Manager, ProcessClose(), OS shutdown, et cetera). It would be nice if this method could be caught and OnAutoItExit() still called, but I don't know if the OS supports that or if its possible to detect in any way.
  • The program (hard) crashes. This usually results in the standard application crash dialog. Obviously, OnAutoItExit() should not be called in this case since not only is there potential for the internal scripting engine to be corrupt but very likely, the entire internal system could be corrupt.
  • Soft crashes, or fatal errors AutoIt encounters such as syntax errors. These should not call OnAutoItExit() because there is no guarantee that the internal state is stable enough for such an operation.

Share this post


Link to post
Share on other sites

IMO, it should NOT be called on an AutoIt error.

I agree.

However, I have to admit it helped me track down a careless an array out-of-bounds error :)

The program is aborted abnormally (via Task Manager, ProcessClose(), OS shutdown, et cetera). It would be nice if this method could be caught and OnAutoItExit() still called, but I don't know if the OS supports that or if its possible to detect in any way.

The WinTools spyware does something like this, but I believe it has two processes monitor one another (WToolsA and WToolsS)

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...