Opt("TrayMenuMode", 1)
#include <Date.au3>
#include <Misc.au3>
#include "Services.au3"
_Singleton(@ScriptName)
;如果已运行则退出
RegWrite('HKEY_CURRENT_USER\Control Panel\International', "sTimeFormat", "REG_SZ", "HH:mm:ss")
;注册表立即生效
DllCall("user32.dll", "int", "SendMessageTimeout", "hwnd", 65535, "int", 26, "int", 0, "int", 0, "int", 0, "int", 1000, "str", "dwResult")
$CFG_Path = @ScriptDir & "\" & StringTrimRight(@ScriptName, 4) & ".ini"
$sleephour = IniRead($CFG_Path, "参数设置", "重启间隔", "2")
If $sleephour < 0.02 Then $sleephour = 24
If $sleephour < 1 Then
$nexthour = _DateAdd('n', Int($sleephour * 60), _NowCalc())
Else
$nexthour = _DateAdd('h', $sleephour, _NowCalc())
EndIf
While 1
Sleep(1000)
time()
WEnd
Func time()
$sleephour = IniRead($CFG_Path, "参数设置", "重启间隔", "2")
If @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC = $nexthour Then
If $sleephour < 1 Then
$nexthour = _DateAdd('n', Int($sleephour * 60), _NowCalc())
Else
$nexthour = _DateAdd('h', $sleephour, _NowCalc())
EndIf
runp()
EndIf
EndFunc ;==>time
Func runp()
;在这里加入你想做的事
EndFunc ;==>runp
Func exit_0()
Exit
EndFunc ;==>exit_0 |