

- Computer shutdown timer update#
- Computer shutdown timer code#
- Computer shutdown timer download#
- Computer shutdown timer free#
- Computer shutdown timer windows#
GresetMsgNew = CANCEL`n%mg%`n%tleftd% mins to %mgg%.ĬontrolSetText, %gresetMsg%, %gresetMsgNew%,Shutdown XP StartTime = %A_TickCount% reset starting time from the system in millisecs Tds := inTime * 60000 convert Timer mins length to milli seconds InTime := Round(inTime,1) round the time length for the timer in mins InputBox, inTime,, Enter new countdown number of`nminutes before %mg%:, ,300,170,5,30 Parameter #3: Pass 1 instead of 0 to disable all wake events.ĭllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)ĭllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0) Parameter #2: Pass 1 instead of 0 to suspend immediately rather than asking each application for permission. Parameter #1: Pass 1 instead of 0 to hibernate rather than suspend.
Computer shutdown timer windows#
Windows 95/NT4: Since this function does not exist, the following call would have no effect. Call the Windows API function "SetSuspendState" to have the system suspend or hibernate. Shutdown, 9 1- shutdown 8 - power down (add both together) MsgBox, 262148, Reset %mgg% timer?`n('No' will just close this timer) MsgBox, 262148, Will %mgg% in %delaysecs% secs.`n`nDo you want to reset the timer or cancel %mgg%?,%delaysecs% SetTimer, CloseIt, off %timeCheckInterval% 15000 timer expired so do action and any final closing you may need Menu, tray, Rename, %resetMsg%, %newresetMsg% NewresetMsg = Re-Set Timer (Time Left: %tleftd% mins to %mgg%) Menu, Tray, Tip, Time Left: %tleftd% mins to %mgg% If (tds > ElapsedTime) if millsecs used, test to see if the time has been exceeded SetTimer, CloseIt, %timeCheckInterval% 1500ĮlapsedTime := (A_TickCount - StartTime) if millisecs used, elapsed time from start time Gui, Add, Button, x100 y115 w150 h35 gResetTimer, Reset Time to %mgg% Gui, Add, Button, x100 y41 w150 h70 gAbort, %gresetMsg%

GresetMsg = CANCEL`n%mg%`n%inTime% mins to %mgg%. Menu, tray, add, %resetMsg%, ResetTimer Show Time Left on Timer = %in%, TimeLeft Menu, Tray, Tip, Time Left: %inTime% mins ResetMsg = Re-Set Timer (Time Left: %inTime% mins to %mgg%) StartTime = %A_TickCount% get starting time from the system in millisecs Tds := inTime *60000 convert Timer mins length to milli seconds InTime := Round(inTime,1) round the time length for the timer in mins to 1 decimal InputBox, inTime,, Enter mins to %mgg% (decimals ok):`n(You have %defaultTimeToAction% secs to enter the time left.), 410,180 ,%defaultTimeToAction%,0 Aborting.ĭefaultTimeToAction = 20 20 secs will be added later MsgBox, 262144, invalid paramater 1 was passed ("%inAction%")`n`nIt can only be either empty or 'shutdown', 'restart', 'sleep', or 'hibernate'. MsgBox, 262148, Wrong action was entered ("%whatToDo%"). InputBox, whatToDo,, what do you want to do?`n(You have 15 secs to change the default action`, which is for Shutdown):`n`n1 - Shutdown`n2 - Restart`n3 - Sleep`n4 - Hibernate, 400,290,, , ,15, 1 SetWorkingDir %A_ScriptDir% Ensures a consistent starting directory. SendMode Input Recom for new scripts due to its superior speed and reliability. #NoEnv Recommended for performance and compatibility w future AutoHotkey releases. param 2 - Optionally, can pass number of minutes to desired action. param 1 - Optionally, can pass 'sleep', 'restart', 'hibernate', or 'shutdown'.
Computer shutdown timer free#
Feel free to change the icon or remove that line:
Computer shutdown timer code#
The code below assumes an icon named 'A computer shutdown ' is in the same directory the script is run from. I hope you find the script as useful as I have.
Computer shutdown timer update#
I won't be updating this script so you are free to update it as you wish. You can also use the tray icon menu for these actions. The time left to the action is continually updated on the button itself. You can abort at any time (just press the Cancel button) or reset the timer (just press the 'Reset') button. Then pick the action wanted (shutdown, hibernate, or sleep).

Just start this timer and enter the number of minutes to the action desired (can use decimals).
Computer shutdown timer download#
Lets say you are in the middle of a download etc., and don't want to wait to shutdown your computer. Here is a short script for a minimal computer shutdown, hibernate, or sleep timer.
