Coder4 0 Posted March 17 Share Posted March 17 (edited) I have a small demo script, as shown below. The ExitHandler() function fires correctly in the following scenarios: When allowing the script to end naturally on its own When exiting the script via the tray icon The ExitHandler() does NOT fire correctly in these scenarios: When compiled as a console ("cui") application and hitting the close button on the console window When compiled as a console ("cui") application and pressing CTRL+C in the console window Do you know if it's possible to trigger any code in these last two scenarios, or does that force quit the script immediately? Either way, it would be good to have the documentation updated to mention this. I'd be happy to contribute documentation if I knew how. #AutoIt3Wrapper_Change2CUI=y OnAutoItExitRegister("ExitHandler") ConsoleWrite("Script started. Waiting 6 seconds." & @CRLF) Sleep(6000) Func ExitHandler() ConsoleWrite("Exit detected." & @CRLF) MsgBox(0, "Exit!", "Exit detected.") EndFunc Edited March 17 by Coder4 Link to post Share on other sites
Developers Jos 2,852 Posted March 17 Developers Share Posted March 17 I assume that you are closing the parent process, being cmd.exe, so its child processes get killed the hard way? 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 post Share on other sites
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now