Rex Posted April 5, 2005 Share Posted April 5, 2005 Hi. I have createt a logoff script, but the script runs both on reboot and on shutdown Is there any way i can check within the script if win is shutingdown or just rebooting ????????????? I'd try to search on the net, but i couldent finde anything Link to comment Share on other sites More sharing options...
Rex Posted April 20, 2005 Author Share Posted April 20, 2005 No one ????????? Link to comment Share on other sites More sharing options...
MarkMarkMark Posted April 20, 2005 Share Posted April 20, 2005 what OS are you running? Link to comment Share on other sites More sharing options...
Rex Posted April 20, 2005 Author Share Posted April 20, 2005 what OS are you running?<{POST_SNAPBACK}>Hi I'm using windows XP Link to comment Share on other sites More sharing options...
Devion Posted April 20, 2005 Share Posted April 20, 2005 Try explain your problem a little more, i coulnt understand it all. A logoff script that runs on shutdown and reboot? :S Link to comment Share on other sites More sharing options...
MarkMarkMark Posted April 20, 2005 Share Posted April 20, 2005 cant u just put the logoffscript in c:\windows\system32\grouppolicies\scripts\usr\logoff ? Link to comment Share on other sites More sharing options...
Rex Posted April 20, 2005 Author Share Posted April 20, 2005 cant u just put the logoffscript in c:\windows\system32\grouppolicies\scripts\usr\logoff ?<{POST_SNAPBACK}>Where do U thing i have placed it ? It's a logoff script NHFWell xp runs the script regardles of it's a reboot or a shutdown, and i only want the script to run when i shutdown my computer Link to comment Share on other sites More sharing options...
Rex Posted April 20, 2005 Author Share Posted April 20, 2005 Try explain your problem a little more, i coulnt understand it all.A logoff script that runs on shutdown and reboot? :S<{POST_SNAPBACK}>I have createt a logoff script that i would like to run ONLY when xp shutsdown.Ass fornow xp run's the scripr at both reboot and shutdown.So i need a way to check if xp is shuting down or just reeboting Link to comment Share on other sites More sharing options...
Ejoc Posted April 20, 2005 Share Posted April 20, 2005 Isn't Computer Shutdown stored in: C:\WINDOWS\System32\GroupPolicy\Machine\Scripts\Shutdown And User Log Off stored in: C:\WINDOWS\System32\GroupPolicy\User\Scripts\Logoff Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
Rex Posted April 20, 2005 Author Share Posted April 20, 2005 Isn'tComputer Shutdown stored in:C:\WINDOWS\System32\GroupPolicy\Machine\Scripts\ShutdownAnd User Log Off stored in:C:\WINDOWS\System32\GroupPolicy\User\Scripts\Logoff<{POST_SNAPBACK}>Yes and noIt's tru that the user logoff script has palce in C:\WINDOWS\System32\GroupPolicy\User\Scripts\Logoff.But sins i'm the only user on my pc, i use the shutdown path, but still xp runs the script un both reboot and on shutdown. Link to comment Share on other sites More sharing options...
Ejoc Posted April 20, 2005 Share Posted April 20, 2005 Checkout HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shutdown Setting Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
MarkMarkMark Posted April 20, 2005 Share Posted April 20, 2005 i think your xp is b0rked when it runs both on startup and shutdown Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted April 20, 2005 Share Posted April 20, 2005 Can you separate the code for the Logoff, and just have the Shutdown call the Logoff if you want? I don't know much else, I haven't done much Windows Admin in a while...horrible teacher (err...babysitter, he doesn't teach)...only been running linux. Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
nobby Posted April 21, 2005 Share Posted April 21, 2005 When windows shutdowns or reboot it does the same shutdown procedure, that is logoff the users, shutdown the OS, only difference is in the commands it passes on to the bios. But as far as the OS is concerned a cold or warm boot is the same. CheersNobby Link to comment Share on other sites More sharing options...
Ejoc Posted April 21, 2005 Share Posted April 21, 2005 I guess no one googles anymore...This is a piece from microsoftThis behavior occurs because Windows writes this information to the following registry key every time your computer is shut down:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ Explorer\Shutdown SettingChecking this registry key when your script is called could tell you if it was Shutdown or reboot... Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
Rex Posted April 23, 2005 Author Share Posted April 23, 2005 I guess no one googles anymore...This is a piece from microsoftChecking this registry key when your script is called could tell you if it was Shutdown or reboot...<{POST_SNAPBACK}>I did google, but i must have used wrong seach word'sNM.I'd try to read the reg but, i't seems that the reg updates after the script so i can't use it to finde out if xp is closing or rebooting.Any other have any sug. Link to comment Share on other sites More sharing options...
megahyperion Posted April 23, 2005 Share Posted April 23, 2005 What does the script do when you shutdown ? Or what is it supposed to do ? Just out of curiousity Link to comment Share on other sites More sharing options...
Rex Posted April 24, 2005 Author Share Posted April 24, 2005 What does the script do when you shutdown ?Or what is it supposed to do ?Just out of curiousity<{POST_SNAPBACK}>Backup some data, mails - documents a.s.o.But with a mailbox size 500Mb and 1.2Gb documents i don't want to wait for the script to backup every time i reboots Link to comment Share on other sites More sharing options...
CyberSlug Posted April 24, 2005 Share Posted April 24, 2005 (edited) IDEA: Don't use shutdown on the Start Menu. Use the following script.- You can even remove the shutdown button from the start menu (simply kill/restart explorer.exe to see effect)- A shutdown icon is also attached!; Script generated by AutoBuilder 0.5 Prototype #include <GuiConstants.au3> If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 $GUI = GuiCreate("MyGUI", 203, 299,(@DesktopWidth-203)/2, (@DesktopHeight-299)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Button_logoff = GuiCtrlCreateButton("Logoff", 20, 30, 150, 40) $Button_shutdown = GuiCtrlCreateButton("Shutdown", 20, 100, 150, 40) $Button_reboot = GuiCtrlCreateButton("Reboot", 20, 170, 150, 40) $Checkbox_force = GuiCtrlCreateCheckbox("Force", 40, 240, 120, 30) GuiSetState() While 1 $msg = GuiGetMsg() $force_status = 4 * ControlCommand($GUI, "",$Checkbox_force,"IsChecked") Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_logoff Shutdown(0 + $force_status) Exit Case $msg = $Button_shutdown Run("Your program goes here") Shutdown(1 + $force_status) Exit Case $msg = $Button_reboot Shutdown(2 + $force_status) Exit EndSelect WEnd ExitshutdownIcon.ico Edited April 24, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Rex Posted April 24, 2005 Author Share Posted April 24, 2005 IDEA: Don't use shutdown on the Start Menu. Use the following script.- You can even remove the shutdown button from the start menu (simply kill/restart explorer.exe to see effect)- A shutdown icon is also attached!; Script generated by AutoBuilder 0.5 Prototype #include <GuiConstants.au3> If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 $GUI = GuiCreate("MyGUI", 203, 299,(@DesktopWidth-203)/2, (@DesktopHeight-299)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Button_logoff = GuiCtrlCreateButton("Logoff", 20, 30, 150, 40) $Button_shutdown = GuiCtrlCreateButton("Shutdown", 20, 100, 150, 40) $Button_reboot = GuiCtrlCreateButton("Reboot", 20, 170, 150, 40) $Checkbox_force = GuiCtrlCreateCheckbox("Force", 40, 240, 120, 30) GuiSetState() While 1 $msg = GuiGetMsg() $force_status = 4 * ControlCommand($GUI, "",$Checkbox_force,"IsChecked") Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_logoff Shutdown(0 + $force_status) Exit Case $msg = $Button_shutdown Run("Your program goes here") Shutdown(1 + $force_status) Exit Case $msg = $Button_reboot Shutdown(2 + $force_status) Exit EndSelect WEnd Exit<{POST_SNAPBACK}>LOL could be a nice way to do it, but i'm not using the start button to shutdown/reboot XP i'm using ctrl+alt+del and the good old win style And decide that it would me more proff. "to do it my way" and i'm sure ther is a way to do it 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