倒计时关机
#Persistent
#SingleInstance,force
Gui, Margin, 5, 5
Gui, Font, S12
Gui, +AlwaysOnTop -MaximizeBox -MinimizeBox
Gui, Add, Edit, w50 h20 +0x2000 +Center vH -Limit, 00
Gui, Add, Text, x+2 w10 h20 +Center, :
Gui, Add, Edit, x+2 w50 h20 +0x2000 +Center vM -Limit, 00
Gui, Add, Button, x+5 w60 h20 Default, &OK
Gui, Show, auto, 倒计时关机
OnExit Cencel
Goto, Menu_Show
return
GuiClose:
ExitApp
Return
ButtonOK:
Gui,Submit
time_s = %A_TickCount%
time := H*3600000+M*60000
time_a += time/1000, Sec
Sleep, %time%
Run, %A_WinDir%\system32\shutdown.exe -s -f,,Hide
Sleep, 180000
Shutdown, 5
Return
GuiEscape:
Cencel:
if A_ExitReason not in Logoff,Shutdown
{
Run %A_WinDir%\system32\shutdown.exe -a,,Hide
}
ExitApp
return
Menu_Show:
{
Menu, Tray, NoStandard
Menu, Tray, Click, 1
Menu, Tray, Tip, 倒计时关机
Menu, Tray, Add, 倒计时关机, Tray_Show
Menu, Tray, ToggleEnable, 倒计时关机
Menu, Tray, Default, 倒计时关机
Menu, Tray, Add
Menu, Tray, Add, 时间(&S), Tray_Time
Menu, Tray, Add
Menu, Tray, Add, 重启(&R), Tray_Reload
Menu, Tray, Add, 退出(&X), Cencel
}
Return
Tray_Show:
Menu, Tray, Show
return
Tray_Reload:
Reload
Return
Tray_Time:
time_e := Ceil((time-(A_TickCount-time_s))/60000)
FormatTime, time_b, %time_a%,MM月dd日`nHH时mm分
msgbox, 262192, 倒计时关机, %time_b%`n剩余 %time_e% 分钟
return