skipperpoop Posted May 20, 2006 Share Posted May 20, 2006 I'm trying to figure out how to terminate a script right before a user shuts down the computer. I've tried looking for the shutdown process so I could use If ProcessExists, but I never found it. I also thought maybe the shutdown window had a name, then I could use If WinExists, but I had no luck with that either. I'm not real knowledgeable when it comes to programming, so any help would be much appreciated.Thanks Link to comment Share on other sites More sharing options...
Daniel W. Posted May 20, 2006 Share Posted May 20, 2006 (edited) ;~ Your code in here While 1 If ProcessExists("shutdown.exe") Then Exit EndIf WEnd Edited May 20, 2006 by Daniel W. --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote] Link to comment Share on other sites More sharing options...
skipperpoop Posted May 21, 2006 Author Share Posted May 21, 2006 Yea, I tried that one already . I think windows might use another process for its shutdown, while shutdown.exe is for manual shutdowns, shutdown shortcuts, etc. Link to comment Share on other sites More sharing options...
VicTT Posted May 21, 2006 Share Posted May 21, 2006 I've posted a while ago on the same matter...You have to intercept a message that is sent to all processes... Global $WM_QUERYENDSESSION=0x0011 Func InterceptShutdown($hWnd,$msg,$w,$l) MsgBox(0,"","Shutting down") EndFunc GUIRegisterMsg($WM_QUERYENDSESSION,"InterceptShutdown") while 1 wend Quote Together we might liveDivided we must fall Link to comment Share on other sites More sharing options...
Developers Jos Posted May 21, 2006 Developers Share Posted May 21, 2006 Func OnAutoItExit ( ) ...EndFuncRemarksInside the function, @ExitCode can be used to retrieve the code set by the exit statement.The mode of exit can be retrieve with @ExitMethod.0 Natural closing. 1 close by Exit function. 2 close by click on exit of the systray. 3 close by user logoff. 4 close by Windows shutdown. 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 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