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

Display

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

How to Display a Countdown Clock

Keywords:   countdown clock

Question:

Was wondering if anyone out there has come out with a way of displaying a "countdown clock" on the screen while waiting for an event to happen?

What I am trying to do is cause a delayed shutdown (which is easy) but keep the user apprised of how much time is left (which isn't). Tried some of the timing functions but they were not able to update the screen rapidly enough. Would like this to countdown per second or two if possible.

Answer:

Something like this, with a little "tweaking" ....
time=10

BoxOpen("CountDown","")
stopped=0

while time > 0
   BoxText(strcat("Time left = ",time,@crlf,"Hit shift key to stop countdown"))
   TimeDelay(1)
   if IsKeyDown(@shift)
      stopped=1
      break
   endif
   time=time-1 
endwhile
if stopped==1
   Message("Countdown","Stopped by user")
else
   Message("Countdown","Timed Out")
endif
exit

Article ID:   W13212
Filename:   Display a Countdown Clock.txt
File Created: 1999:04:15:16:52:30
Last Updated: 1999:04:15:16:52:30