
Code: Select all
; For more info...
; http://support.microsoft.com/kb/313565
; This adds a task to run Windows Calculator one time only within the next minute
; Allow extra processing time if clock time is about to change to the next minute
; otherwise the task will wait 24 hours
If Second(Date()) > 55
runtime$ = FormatDate("%hh:%ii", AddDate(Date(), #PB_Date_Minute, 2))
Else
runtime$ = FormatDate("%hh:%ii", AddDate(Date(), #PB_Date_Minute, 1))
EndIf
runProg = RunProgram("cmd", "/c at " + runtime$ + " /interactive calc.exe", "", #PB_Program_Hide | #PB_Program_Open)
result = WaitProgram(runProg)
If ProgramExitCode(runProg) <> 0
MessageRequester("Error", "Unable to process command." + #crlf$ + "Check to make sure Task Scheduler is running.", #MB_OK | #MB_ICONERROR)
Else
MessageRequester("Success", "New task has been set to run at " + runtime$, #MB_OK | #MB_ICONINFORMATION)
EndIf
CloseProgram(runProg)