Search the Community
Showing results for tags 'shutdown timer'.
-
Hi ppl, i created this because i felt the need for it, what it does is shutdown the computer after X minutes, set by the user. So it's basically a small gui, with an input box, to write the number of minutes to wait before shutdown, and a button to start the count, and a reboot button, just because i felt the need for it. #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=ResourcesClock.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Icon_Add=ResourcesClock.ico #AutoIt3Wrapper_Run_Tidy=y #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Opt("TrayAutoPause", 0) Opt("GUIOnEventMode", 1) #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Time4Shutdown", 395, 32, 250, 475, -1, $WS_EX_DLGMODALFRAME) GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $settime = GUICtrlCreateInput("", 168, 5, 49, 21) $Label1 = GUICtrlCreateLabel("Set time for shutdown in minutes", 8, 8, 156, 17) $Button1 = GUICtrlCreateButton("Start", 234, 3, 75, 25) GUICtrlSetOnEvent($Button1, "Start") $Button2 = GUICtrlCreateButton("Reboot", 314, 3, 75, 25) GUICtrlSetOnEvent($Button2, "Reboot") GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### $Multiplier = "60000" Func Start() GUISetState(@SW_HIDE) $time = GUICtrlRead($settime, 1) MsgBox(4096, "Shutdown notice", "Set to shutdown in: " & $time & " minutes.") $timetosleep = $time * $Multiplier Sleep($timetosleep) Shutdown(13) EndFunc ;==>Start Func Reboot() Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(4164, "Notice", "Do you really want to reboot?") Select Case $iMsgBoxAnswer = 6 ;Yes Case $iMsgBoxAnswer = 7 ;No EndSelect If $iMsgBoxAnswer = 6 Then ;MsgBox(4096, "Notice", "Clicked Yes! Going to reboot") Shutdown(6) ElseIf $iMsgBoxAnswer = 7 Then ;MsgBox(4096, "Notice", "Clicked No! Aborting reboot") EndIf EndFunc ;==>Reboot Func Close() Exit EndFunc ;==>Close Do Sleep(100) Until $Form1 = $GUI_EVENT_CLOSE UPDATE: Removed close button, and added a reboot button, optional message boxes in reboot function. Greetings. Time4Shutdown.au3