rudi Posted January 8, 2008 Share Posted January 8, 2008 Hello, can autoit3 scripts recognize, when they get a signal to terminate, either by user action, another program or a windows shutdown? I'd like to be able to do cleanup actions (write a final line to log file with reason, date+time of script termination) or to interrupt a triggered windows shutdown ("do you really want to shutdown your windows?") Thanks for any suggestions, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Xenobiologist Posted January 8, 2008 Share Posted January 8, 2008 Hi, OnAutoItExit () So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
rudi Posted January 8, 2008 Author Share Posted January 8, 2008 Hello,thanks for your reply.OnAutoItExit ()I did read it but missed it's functionality. (thought it's about setting something like exitcode, my fault)May I ask for the functionality?0 Natural closing. The script simply reached the last line of it's code?1 close by Exit function. there was a line reached doing an "EXIT" in the script2 close by clicking on exit of the systray. Only when clicking exit on the systray?3 close by user logoff.well, logoff4 close by Windows shutdown. Do you know what happens, when another script sends a winclose or a winkill, kill.exe is used or "end task" from task manager?And how to write a autoit script some type of "hardened", so that it will *NOT* simply follow such requests, but pop up a dialog asking "do you really ...?" with an option to stop the "Sender" doing it's kill? e.g. some AV solutions can do so when an update is currently running to prevent a resulting status with a non operational AV scanner.Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 8, 2008 Share Posted January 8, 2008 Just test it for yourself. Run this in SciTE: While 1 Sleep(20) WEnd Func OnAutoItExit() ConsoleWrite("Debug: OnAutoItExit: @ExitCode = " & @exitCode & " @ExitMethod = " & @exitMethod & @LF) EndFunc Then kill it however you wish. If you remove the While loop, so there is no code but the one function, it exits with "@ExitCode = 0 @ExitMethod = 0". Replace the While loop with just Exit, and you get "@ExitCode = 0 @ExitMethod = 1". Running the While loop, and using Exit on the TrayIcon gets "@ExitCode = 0 @ExitMethod = 2". Killing AutoIt3.exe from TaskManager results in a return of 2, but the function doesn't execute at all. ...etc., etc., test the method you are interested in. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
The Kandie Man Posted January 9, 2008 Share Posted January 9, 2008 You may find this to be of some interest:http://www.autoitscript.com/forum/index.ph...st&p=285943- The Kandie Man ;-) "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
rudi Posted January 17, 2008 Author Share Posted January 17, 2008 Thanks to both of you, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! 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