Re: VBScript - Wait
by "Phil Babcock" <pbabcock(at)bgsgroup.com>
|
| Date: |
Tue, 14 Nov 2000 09:54:20 -0500 |
| To: |
"Cyanide _7" <leo7278(at)hotmail.com>, hwg-languages(at)hwg.org |
| References: |
hotmail |
| |
todo: View
Thread,
Original
|
|
Well VBScript is single threaded so "waiting" is hard to do. Typically a=
language will spawn a new thread to do the "waiting" with, but VBScript=
can't do this. In VB (ie not Script) there is the timer control that you=
can use, but I do not know of such a thing in VBScript.
However, you can do somthing like this:
<script language=3D"VBScript">
private sub command_click
dim complete
complete =3D DateAdd("s", 5, Now)
msgbox "starting at: " & Now & vbcrlf & "will complete at: " & restartat
while Now <=3D complete
'nothing
wend
msgbox "completed"
end sub
</script>
<form id=3Dform1 name=3Dform1>
<input value=3Dclick type=3Dbutton name=3Dcommand=
onclick=3D"command_click">
</form>
But this is not really good to do; any more than a few seconds and IE balks=
(it displays a message that a script is causing it to run slowly and asks=
if you would like to abort.) The while loop just continually checks the=
time and compares it to the "complete" value. Inside the loop nothing=
happens so the loop executes an unimaginable amount of times.... if you=
could give the loop something to do then this script might be ok. For=
example if you had a bunch of other code that you wanted to execute inside=
the loop then this might work.
It's not perfect, but...
hth,
phil.
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.