WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time - Timer and Date Functions
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Timer Script to Start Every Day/Once a Week at a Specific Time

Keywords: timewait timejulianday   

WinBatch now has the function TimeWait which can watch the system time and then proceed when that time is reached.

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.

You also use WinBatch to launch a third party schedule. The scheduler which comes with Norton Anti-Virus for Win95 works fine with Winbatch. And Clockman also works well.

Script to Launch a Specific Day of the Week:

;;This script will launch a program at a specified time
;;on a certain day of the week.

;Incontrol 12 is used to direct WIL and it's parent application 
;(if the parent application supports this function) 
;as to how to handle users either terminating WinBatch 
;via the "Ctrl-Break" keystroke sequence or perhaps a menu item, 
;or by simply exiting windows.

Intcontrol(12,9,0,0,0)

while 1
    ttt="0000:00:00:18:00:00"; 6 PM 
    TimeWait(ttt);Waits for 6 PM
    a=TimeYmdHms()
    b=TimeJulianDay(a) 
    c=(b+5) mod 7
    day=ItemExtract(c+1, "Sun Mon Tue Wed Thu Fri Sat", " ")
    
    If day=="Thu"; Checks to see if it's Thursday
     run("yourprog.exe","")
    Endif 
    Timedelay(10) 
endwhile

Script to Launch Every Day of the Week at 11pm:

;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  


Article ID:   W13881
Filename:   Scheduling with the TimeWait Function.txt
File Created: 2000:11:17:11:30:34
Last Updated: 2000:11:17:11:30:34