Timing and Wakeup Scripts - TimeWait Function
Keywords: time wait TimeWait timing pause wakeup
Question:
How can I set up a program that will wake up and run every X minutes?
Answer - Example #1:
Timedelay waits the number of seconds specified, and then continues on with your script.
while 1
TimeDelay(300) ; 60*5 = 5 minutes
Message("Yoo Hoo","Another 5 minutes went by...")
endwhile
Answer - Example #2:
TimeWait pauses execution and waits for the date/time to pass.
This function can be used from a WinBatch script as a timer.
It waits until the time has been reached and then continues execution.
The objective here is to launch a second WBT when the designated time is reached.
Example:
;Build the current day and attach your desired time using StrCat.
day=TimeYmdHms() ;;Get the current date and time
year=ItemExtract(1,day,":")
month=ItemExtract(2,day,":")
day=ItemExtract(3,day,":")
;;concatenate the parts back together, adding the time field to the end.
time=StrCat(year, ":", month, ":", day, ":", "13:45:00")
TimeWait(time)
Run("the2nd.wbt", "")
Article ID: W13895
Filename: Timing and Wakeup Scripts.txt