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.

Custom Countdown Clock

Keywords: 	  custom countdown clock

;-----------------------------------------------------------------------------------
:init

btn = 0
starttime = timeymdhms()
endtime = timeadd(starttime,"00:00:00:00:00:3600")

LTGRAY="192,192,192"
BLACK="0,0,0"

;-----------------------------------------------------------------------------------
:main

wbid = 1
BoxesUp("100,300,500,600",@normal)
BoxCaption(wbid,"Countdown Timer")
BoxColor(wbid,LTGRAY,0)
BoxDrawRect(wbid,"0,0,1000,1000",2)
BoxTextFont(wbid,"Arial",70,60,0)
BoxTextColor(wbid,BLACK)

BoxDrawText(wbid,"5,5,1000,1000",starttime,1,0)

BoxButtonDraw(wbid,1,"Exit now","25,875,200,975")
BoxDataTag(wbid,"here") ; to control the stack

while !btn
btn = BoxButtonStat(1,1)
Timedelay(.1)
now = timeymdhms()
secs = timediffsecs(endtime,now)
diff = timediff(endtime,now)
BoxDrawText(wbid,"70,500,1000,1000",diff,1,0)
BoxDrawText(wbid,"700,875,1000,1000",secs,1,0)
if secs == 0 then break
if secs mod 10 == 0 then boxdataclear(wbid,"here") ; don't let the stack overflow!
endwhile 

boxdestroy(wbid)
;message("Timeout",btn)

;-----------------------------------------------------------------------------------
:END
exit


Article ID:   W15718
File Created: 2003:05:13:11:29:48
Last Updated: 2003:05:13:11:29:48