bobsobol Posted October 15, 2006 Share Posted October 15, 2006 I'm trying to make an OnExitFunction which cleans up the temporary files it created if it finds half way through that it can't process the rest. Insufficient file/directory privaliges can cause this, and it's not just a matter of being an Admin. I can't test for it before I've created the Temporary files, because they will determine what directories and files you need to have write privalages for. My script will become very large if I need to write cleanup code for all the places it might fail so an OnExitFunction is ideal. (GoTo would do but it's only for onerror GoTo)Trouble is all the other Opt() functions need an Option name as String and a parameter as number. How do I set the parameter of Opt() for the "OnExitFunction" option? The help files description:- OnExitFunc Sets the name of the function called when AutoIt exits (default is OnAutoItExit).Isn't particulaly helpful as the line:- Opt("OnExitFunction",OnAutoItExit)or Opt("OnExitFunction","OnAutoItExit")Fails too. Anybody get this fascility to work who can provide a good example? Link to comment Share on other sites More sharing options...
jpm Posted October 15, 2006 Share Posted October 15, 2006 Opt("OnExitFunc","MyOnAutoItExit") Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 15, 2006 Share Posted October 15, 2006 I've had the function working just fine. Just add Func OnAutoItExit() ;code here EndFunc and insert your code in the function. OnAutoItExit is the default function, so if it is found, it will be called. Link to comment Share on other sites More sharing options...
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