VBS计时器

用VBS实现一个以分钟为单位的计时器:

 1 rem msgbox now 'now is the system para
 2 
 3 msgbox "Timer",,"CreatedByXuTao"
 4 dim limit
 5 limit = int(inputbox("Set your time in minutes!",,Setting))
 6 
 7 dim a,b,c '保证只提醒一次
 8 a=0
 9 b=0
10 c=0
11 
12 dim cur
13 cur = 0
14 
15 m = hour(now)*60 + minute(now)
16 
17 while cur<limit
18 
19 cur = hour(now)*60+minute(now) - m
20 Wscript.sleep 10000
21 
22 if limit-cur=10 and a=0 then
23 msgbox "10 Minutes Left!",,"Warnning"
24 a=1
25 elseif limit-cur=5 and b=0 then
26 msgbox "5 Minutes Left!",,"Warnning"
27 b=1
28 elseif limit-cur=1 and c=0 then
29 msgbox "1 Minute Left!",,"Warnning"
30 c=1
31 end if
32 
33 wend
34 
35 msgbox "Time is up!",,"OVER"

猜你喜欢

转载自www.cnblogs.com/XT-xutao/p/10052675.html