Autohotkey script doesn't work on machines that have been up for a long time.
This works great on the machine I have autohotkey installed, but not on my test machine, which doesn't. I don't think that matters, because it is compiled as an exe, right? (i know, dumb question)
My test machine has been up for 51 days. However, it only shows it have been up for one day, seven hours, 47 minutes and change.
I inserted the message box because I thought I was crazy, because when I set the max uptime to 14 days, it ran and did nothing on the machine that had been up for 51 days.
If someone (my hero Joe W.?) could please take a look at this and tell me what I am doing wrong, I would really appreciate it.
The files attached are the ahk and a screen shot showing the message box and the system uptime, so you don't think I am nuts.
Here is the code if you don't want to open the file...
#Warn,UseUnsetLocal ; warning on uninitialized variables
#NoTrayIcon ; do not show an icon in the system tray
#NoEnv ; avoid checking empty variables to see if they are environment variables
#SingleInstance ignore ; leave old instance running
SetBatchLines,-1 ; run at maximum speed
T = 20000101000000
T += A_TickCount/1000,Seconds
FormatTime FormdT, %T%, HH:mm:ss
FormatTime Days, %T%, YDay
MsgBox % Days-1 " days " FormdT
; begin params you may want to change
UptimeDaysLimit:=14
NagTimeMinutes:=15
; end params you may want to change
NagTime:=1000*60*NagTimeMinutes ; param to Sleep is in milliseconds
TryAgain:
UptimeSeconds:=A_TickCount/1000
UptimeDays:=UptimeSeconds/(60*60*24)
If (UptimeDays>UptimeDaysLimit)
{
MsgBox,4401,This Vidant Health Computer Needs a Break!, This system has been up for %UptimeDays% days`n`nClose your open programs, then click OK to reboot`n-----or -----`nHit cancel, or Enter to be reminded again in %NagTimeMinutes% minutes.`n`n`nThanks, Vidant Health Information Services
IfMsgBox,OK
Shutdown,2
Else
{
Sleep,%NagTime%
Goto,TryAgain
}
}
ExitApp Untitled.png RebootNag.ahk