Re: Sleep until any keystroke
- From: vdjatsuk@xxxxxxxxx
- Date: 23 May 2007 03:58:19 -0700
Dim StartTime, EndTime, input
StartTime = Time
EndTime = DateAdd("s", 2, Time)
Do Until StartTime=EndTime
WScript.echo "press enter"
do while not wscript.StdIn.AtEndofLine
input=input & wscript.StdIn.ReadLine
Loop
wscript.quit
Loop
Where and how should i add wscript.quit after the timer has been run?
On 23 май, 12:37, Jeffery Hicks <jhi...@xxxxxxxxxx> wrote:
vdjat...@xxxxxxxxx wrote:
Hi Jeffery,
Thanks for the help.
This is not exactly what i need. The script should be running timer
(wscript.sleep) for some 10 minutes and the any keystroke would break
the sleep and
it will start another command.
Best regards,
Vitali.
On 22 , 17:25, Jeffery Hicks <jhi...@xxxxxxxxxx> wrote:
vdjat...@xxxxxxxxx wrote:
Hi,You need a loop like this:
Could you please help me to write a script which makes wscript.sleep
until any keystroke.
This is my attempt:
Dim Input
Input = Input & WScript.StdIn.Read(1)
If input is TRUE then
wscript.quit
Else wscript.sleep 5000
End If
Dim x
WScript.echo "Enter some text and press Enter twice:"
do while not wscript.StdIn.AtEndofLine
x=x & wscript.StdIn.ReadLine
Loop
WScript.echo "You entered " & x
wscript.quit
--
Jeffery Hicks
SAPIEN Technologies - Scripting, Simplified.www.SAPIEN.com
VBScript & Windows PowerShell Training -www.ScriptingTraining.com/classes.asp
Windows PowerShell? -www.SAPIENPress.com/powershell.asp
blog:http://blog.SAPIEN.com
blog:http://jdhitsolutions.blogspot.com
In that case you can't use Wscript.Sleep What you might do is use
DateAdd to calculate a future time, how long you want to wait and create
an outer loop that runs until the current time matches the target time.
Within the loop, insert the Do While stdin example. Add a line to jump
to quit after the loop.
--
Jeffery Hicks
SAPIEN Technologies - Scripting, Simplified.www.SAPIEN.com
VBScript & Windows PowerShell Training -www.ScriptingTraining.com/classes.asp
Windows PowerShell? -www.SAPIENPress.com/powershell.asp
blog:http://blog.SAPIEN.com
blog:http://jdhitsolutions.blogspot.com
.
- Follow-Ups:
- Re: Sleep until any keystroke
- From: Jeffery Hicks
- Re: Sleep until any keystroke
- From: Jeffery Hicks
- Re: Sleep until any keystroke
- References:
- Re: Sleep until any keystroke
- From: Jeffery Hicks
- Re: Sleep until any keystroke
- Prev by Date: Re: vbScript on VISTA Problems?
- Next by Date: Re: Theme code question
- Previous by thread: Re: Sleep until any keystroke
- Next by thread: Re: Sleep until any keystroke
- Index(es):
Relevant Pages
|