Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #8911
| Newsgroups | microsoft.public.scripting.wsh, microsoft.public.scripting.jscript, comp.lang.javascript |
|---|---|
| Subject | Re: WSH JScript single-character input ? |
| From | "Evertjan." <exjxw.hannivoort@interxnl.net> |
| References | <uoakTIUJH$2OFwlT@invalid.uk.co.demon.merlyn.invalid> <Xns9FB25FFDC43A0eejj99@194.109.133.133> <77d70311-87b1-48ba-b8ce-4d9c69b4f5ad@gl2g2000vbb.googlegroups.com> |
| Message-ID | <Xns9FB2C2236F6CEeejj99@194.109.133.133> (permalink) |
| Date | 2011-12-05 18:05 +0000 |
Cross-posted to 3 groups.
Dr J R Stockton wrote on 05 dec 2011 in comp.lang.javascript:
> On Dec 5, 8:26ÿam, "Evertjan." <exjxw.hannivo...@interxnl.net> wrote:
>> Dr J R Stockton wrote on 04 dec 2011 in
>> microsoft.public.scripting.jscrip
> t:
>>
>> > Can command-line JScript, running in Windows script Host, read a
>> > *single* character from the keyboard without needing Enter? ÿMy old
>> > 16-bit Pascal directory program HUNT accepts single-character
>> > responses for Yes/No/Quit, and it would be nice to have my 32-bit
>> > WSH version of it do the same.
>>
>> StIn without pipe will read from the keyboard.
>>
>> ========== test.js ==========
>> var input = '';
>> while (!WScript.StdIn.AtEndOfLine) {
>> ÿ ÿinput += WScript.StdIn.Read(1) + '-';}
>>
>> WScript.Echo(input);
>> ========================
> =====>
>> run with cscript [wscript has no StIn] in the cmd-console:
>>
>> cscript test.js
>
>
> Requires Enter.
>
Then I guess it cannot be done, as shown by scriptingguy in 2004:
<http://blogs.technet.com/b/heyscriptingguy/archive/2004/10/05/how-can-i-
pause-a-script-and-then-resume-it-when-a-user-presses-a-key-on-the-
keyboard.aspx>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
WSH JScript single-character input ? Dr J R Stockton <reply1148@merlyn.demon.co.uk> - 2011-12-04 22:18 +0000
Re: WSH JScript single-character input ? "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-12-05 08:26 +0000
Re: WSH JScript single-character input ? Dr J R Stockton <J.R.Stockton@physics.org> - 2011-12-05 07:38 -0800
Re: WSH JScript single-character input ? "Evertjan." <exjxw.hannivoort@interxnl.net> - 2011-12-05 18:05 +0000
Re: WSH JScript single-character input ? Tom Lavedas <tglbatch@verizon.net> - 2011-12-05 12:33 -0800
csiph-web