While...Wend

上一篇 / 下一篇  2010-03-23 22:01:32 / 个人分类:VBScript

While...Wend


It is read as follows: "While statement A is true, we will continue to loop through the code. Once it is met, then we will exit at the Wend statement." It is very similar to a Do...Until loop statement.

Example:WhileWendLoop.vbs

Option Explicit
'On Error Resume Next
dim dtmTime

Const hideWindow = 0
Const sleepyTime = 1000
dtmTime = timeSerial(19,25,00)
while dtmTime > Time
WScript.Echo "current time is: " & Time &_
" counting to " & dtmTime
WScript.Sleep sleepyTime
Wend
subBeep
WScript.Echo dtmTime & " was reached."

Sub subBeep
Dim objShell
Set bjShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c echo " & Chr(07),hideWindow
End Sub


 

 

From
Microsoft® VBScript. Step by Step
By Ed Wilson


TAG:

 

评分:0

我来说两句

Open Toolbar