Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #12314

Re: Waiting for keypress in a console - I've got problems.

From "R.Wieser" <address@not.available>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Waiting for keypress in a console - I've got problems.
Date 2020-12-28 18:18 +0100
Organization Aioe.org NNTP Server
Message-ID <rsd40g$duc$1@gioia.aioe.org> (permalink)
References <rscnqt$346$1@gioia.aioe.org> <XnsACA1AFCE66BAeejj99@194.109.6.166>

Show all headers | View raw


Evertjan,

> If you are content with 'enter':
...
> WScript.StdIn.ReadLine

Yeah, thats a lot simpler (why did I not think of that myself ?).  Thanks.

> Or with a box:

That's what I'm trying to replace. :-)   (I'm often running the scripts in a 
full-screen console)

By the way, do you have any idea why that first code sample I posted waits
until 'Enter' is pressed ?    Somehow I read it as something that should
just empty the StdIn buffer.

Regards,
Rudy Wieser




"Evertjan." <exxjxw.hannivoort@inter.nl.net> wrote in message
news:XnsACA1AFCE66BAeejj99@194.109.6.166...
> "R.Wieser" <address@not.available> wrote on 28 Dec 2020 in
> microsoft.public.scripting.vbscript:
>
>> Hello all,
>>
>> I run scripts in a console window, and sometimes need to have them wait
>> for a keypress before continuing.  For that I found the below code :
>>
>> - - - - - - - - - - - - - - - - - - - -
>>   Wscript.StdOut.Write vbNewLine & "Press ENTER to continue. "
>>
>>   Do While Not WScript.StdIn.AtEndOfLine
>>     Input = WScript.StdIn.Read(1)
>>   Loop
>> - - - - - - - - - - - - - - - - - - - -
>
> If you are content with 'enter':
>
> ===================
> WScript.Echo "Press [ENTER] to continue..."
> ' This will not return until [ENTER] is pressed.
> WScript.StdIn.ReadLine
> WScript.Echo "Done."
> ===================
>
> Or with a box:
>
> ===================
> MsgBox("Press [ENTER] to continue...")
> WScript.Echo "Done."
> ===================
>
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)


Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Waiting for keypress in a console - I've got problems. "R.Wieser" <address@not.available> - 2020-12-28 14:50 +0100
  Re: Waiting for keypress in a console - I've got problems. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-12-28 17:16 +0100
    Re: Waiting for keypress in a console - I've got problems. "R.Wieser" <address@not.available> - 2020-12-28 18:18 +0100
      Re: Waiting for keypress in a console - I've got problems. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-12-29 00:21 +0100
        Re: Waiting for keypress in a console - I've got problems. "R.Wieser" <address@not.available> - 2020-12-29 08:28 +0100
          Re: Waiting for keypress in a console - I've got problems. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-12-29 13:26 +0100
            Re: Waiting for keypress in a console - I've got problems. "R.Wieser" <address@not.available> - 2020-12-29 14:46 +0100
  Re: Waiting for keypress in a console - I've got problems. JJ <jj4public@gmail.com> - 2020-12-29 11:44 +0700
    Re: Waiting for keypress in a console - I've got problems. "R.Wieser" <address@not.available> - 2020-12-29 08:26 +0100

csiph-web