Path: csiph.com!aioe.org!wIgm+2MIUUYkuZKIR0Uhug.user.gioia.aioe.org.POSTED!not-for-mail From: "R.Wieser" Newsgroups: microsoft.public.scripting.vbscript Subject: Re: Waiting for keypress in a console - I've got problems. Date: Mon, 28 Dec 2020 18:18:04 +0100 Organization: Aioe.org NNTP Server Lines: 64 Message-ID: References: NNTP-Posting-Host: wIgm+2MIUUYkuZKIR0Uhug.user.gioia.aioe.org X-Complaints-To: abuse@aioe.org X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 X-Priority: 3 X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Original X-MSMail-Priority: Normal X-Notice: Filtered by postfilter v. 0.9.2 Xref: csiph.com microsoft.public.scripting.vbscript:12314 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." wrote in message news:XnsACA1AFCE66BAeejj99@194.109.6.166... > "R.Wieser" 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)