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.

TimeWait Scheduling Application from a User

Keywords: 	 timewait

Question:

I am having trouble putting all the Time functions together to accomplish my task ... I want to create a script that will run a specific program every night at 10:00 pm. It seems to be working all right, except that I can't get it to start every night at 10:00 pm! Can you help?

Answer:

Just use the TimeWait function ala
while 1
     TimeWait("0000:00:00:22:00:00")
    ; do stuff here
    TimeDelay(60)
endwhile
Here is an example of a scheduling program from one of our users:
; openmimi.wbt
; This program will run a program called "MIMI.EXE"
; from the location and at the time specified in an
; ini file called "OPENMIMI.INI". It will also use
; sendkey to send a command (supplied by the ini file)
; to MIMI.EXE after MIMI.EXE runs.

; Open ini file and
; 1) read location of program to run
; 2) read sendkey info to supply program when it runs
; 3) read start time
; Example of the 3 entries in the ini file:
; line 1> C:\MIMI\BIN\MIMI.EXE
; line 2> C:\MIMI\CASES\DEMO.CAS
; line 3> 0000:00:00:12:30:00
params=fileopen("c:\winnt\openmimi.ini","READ")
x=FileRead(params)
mimi=x
x=FileRead(params)
mimicase=x
x=FileRead(params)
starttime=x
FileClose(params)

; Wait until start time occurs
TimeWait(starttime)

; If program is already running then activate,
; otherwise execute the program
If WinExist("MIMI") == @TRUE 
WinActivate("MIMI")
Else
Run("%mimi%"MIMI.EXE, "")
Endif

; Fill the screen the the program you ran
WinZoom("MIMI")

; Send the info read from the 2nd line of the ini file
; to the program
SendKey("!fo!n%mimicase%~")

; End this little program
Return

Article ID:   W13893
Filename:   TimeWait Scheduling Routine.txt
File Created: 2001:04:30:10:12:48
Last Updated: 2001:04:30:10:12:48