I could use a little help with the following code.
The OnEvent>TIME... is not working and i don´t know why.

Code: Select all
Let>appTitle=N.A. Shutdown
Let>appQuit=0
AddTrayIcon>%SCRIPT_DIR%\Gray.ico,trayIcon,%appTitle%%CRLF%Scheduler not set
AddTrayHandler>trayIcon,OnClick,TrayIconClick
While>appQuit=0
Wait>0.1
EndWhile
Exit>0
SRT>TrayIconClick
Let>popupMenuItems=Shutdown Now;Shutdown in 5 minutes;-;Exit
GetCursorPos>xPos,yPos
PopupMenu>xPos,yPos,popupMenuItems,popupMenuResult
If>popupMenuResult=0
ModTrayIcon>trayIcon,%appTitle%%CRLF%Windows is shuting down...,%SCRIPT_DIR%\Red.ico,True
Wait>5
ShutDownWindows>3
EndIf
If>popupMenuResult=1
GetDate>currentDate
GetTime>currentTime
TimeAdd>currentTime,M,1,shutdownTime
TimePart>currentTime,H,currentHour
TimePart>shutdownTime,H,shutdownHour
Let>laterDay=0
If>shutdownHour<currentHour>laterDay=1
Else
TimePart>currentTime,M,currentMinute
TimePart>shutdownTime,M,shutdownMinute
If>shutdownMinute<currentMinute>laterDay=1
EndIf
EndIf
If>laterDay=1
DateAdd>currentDate,D,1,currentDate
EndIf
TimePart>shutdownTime,H,shutdownHour
If>shutdownHour<10>shutdownHour=0%shutdownHour%
EndIf
TimePart>shutdownTime,M,shutdownMinute
If>shutdownMinute<10>shutdownMinute=0%shutdownMinute%
EndIf
Let>WIN_SLEEP=1
OnEvent>TIME,%shutdownHour%%shutdownMinute%,,TimeEvent
ModTrayIcon>trayIcon,%appTitle%%CRLF%Windows will shutdown at %currentDate% %shutdownHour%:%shutdownMinute%,%SCRIPT_DIR%\Red.ico,True
EndIf
If>popupMenuResult=3
DelTrayIcon>trayIcon
Let>appQuit=1
EndIf
END>trayIconClick
SRT>TimeEvent
Message>Go
//If>popupMenuResult<0>5
// ShutDownWindows>3
//EndIf
END>TimeEvent
César Baptista