Jump to content
Sign in to follow this  

External app is trying to close my script

Recommended Posts


When External app is trying to close my script is there any way i could have my script to know about it ?

For example using another script to close compiled running loop, is there anyway for that compiled running loop to identify that something is trying to close it and run some sort of function ?

Maybe something like


or maybe i need some kind of case for my loop ?


Case $On_Autoit_Close



Func somefunc()

msgbox(0,'','something is closing this app')

;do something Then



BTW there is no GUI or anything like that, just this simple loop with checking if process exist or not.

I think i saw this somewhere but i just cant find it anymore.

Am i looking for impossible ? :mellow:

Thanks in advance.

Share this post

Link to post
Share on other sites

Sounds like you want OnAutoItExitRegister()

Registers a function to be called when AutoIt exits ?

I think i need to execute function but maybe i dont understand the word register ?

Ok its registered, then what ? Does it register function that will be executed once script is exited ? :mellow:


I found

Opt("OnExitFunc", "endscript") somehow its not working with current AUTOIT release.


ERROR: Opt() called with illegal argument 1: "OnExitFunc"

Opt("OnExitFunc", "endscript")

And for some reaons for Opt help file shows

AutoItSetOption ( "option" [, param] )

Also i cant open any script from help file after installing new version.

With new version somethings just dont work, for example code prediction as you type would sometimes go away for no reason at the beginning of typing command ("


Edited by dirty

Share this post

Link to post
Share on other sites

Taken from the help file (Your best source for help) "Registers a function to be called when AutoIt exits.". So yes, when it exists the function will be called.

Also out of curiosity, what is trying to close you script? An Anti Virus?

FireDaemon. I just want to make sure critical exit code executed before it shut down.

I also noticed that ending process in task manager voids this function, so how do other applications exiting my script ? Do they close it gently or something ?

I wonder if autoit can close other applications gently, not just by processclose command.

Thanks for reply

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