Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: timewait timejulianday
TimeWait("0000:00:00:07:30:00")
In the old days, WinBatch did not have a timer. WinBatch emulated such by closely watching the system time and zeroing in on the desired time param1 is the variable that contains the desired time in this format: hh:mm. ten thirty o'clock PM is 22:30. Note that timer string formats in Windows are set in the International section of the Windows Control Panel (folder).
;Assuming you want to run a job M-F at 11 pm ;First wait for 11 pm while 1 ttt="0000:00:00:23:00:00" TimeWait(ttt) ;now see if it is m-f a=TimeYmdHms() b=TimeJulianDay(a) c=(b+5) mod 7 if (c==0) || (c==6) then continue ; if the day if Sunday or Saturday, then transfer control back to while loop for re-eval run("yourjob.exe","") TimeDelay(60) endwhile
IntControl(12,9,0,0,0) ;refuse to terminate WB; allow Windows termination quietly While 1 ; do forever TimeWait("0000:00:00:02:00:00") Message("Yoohoo","It's two in the morning") TimeDelay(10) endwhile
Hour=ItemExtract(1,param1,":") Minute=ItemExtract(2,param1,":") LaunchTemp=Hour*60+Minute Now=GetExactTime() NowHour=ItemExtract(1,Now,":") NowMinute=ItemExtract(2,Now,":") NowTemp=NowHour*60+NowMinute if NowTemp>LaunchTemp then bLater=@TRUE else bLater=@FALSE ; setup complete. Now we wait :CheckTime Now=GetExactTime() NowHour=ItemExtract(1,Now,":") NowMinute=ItemExtract(2,Now,":") NowTemp=NowHour*60+NowMinute if NowTemp==LaunchTemp then return if (NowTemp>LaunchTemp && !bLater) then return ; compute how long to wait WaitTime=LaunchTemp-NowTemp if WaitTime<0 then delay(1800) then goto checktime bLater=@FALSE if WaitTime>60 then delay(1800) then goto checktime if WaitTime>10 then delay(120) then goto checktime if WaitTime>1 then delay(30) then goto checktime return
Article ID: W13891
Filename: Timer to Start Every Day or M-F at a Specific Hour.txt
File Created: 2001:01:09:11:19:30
Last Updated: 2001:01:09:11:19:30