timed input [to wait some time]

S

sali

on win/xp, is tehre option to have user's input waitting for some time?

on win/98 there was command "choice" with option to wait on keypress for
predefined number of secs
on win/xp i have set command "set /p variable=[promptstring] which waits
forever
there is also "pause" which also waits forever.

i know i may use third-party solutions, but i am interested in standard one
is there some win/xp-os-built-in option to put message on screen and wait
some time for user's respond before continuing?

thnx
 
P

Pegasus \(MVP\)

sali said:
on win/xp, is tehre option to have user's input waitting for some time?

on win/98 there was command "choice" with option to wait on keypress for
predefined number of secs
on win/xp i have set command "set /p variable=[promptstring] which waits
forever
there is also "pause" which also waits forever.

i know i may use third-party solutions, but i am interested in standard
one
is there some win/xp-os-built-in option to put message on screen and wait
some time for user's respond before continuing?

thnx

There is no native command in WinXP to achieve this.
 
S

sali

Pegasus (MVP) said:
There is no native command in WinXP to achieve this.

does it mean that my win/xp cmd script is badly designed if i need that
feature?
[on win/98 it was solved naturaly]
 
F

foxidrive

on win/xp, is tehre option to have user's input waitting for some time?

on win/98 there was command "choice" with option to wait on keypress for
predefined number of secs
on win/xp i have set command "set /p variable=[promptstring] which waits
forever
there is also "pause" which also waits forever.

i know i may use third-party solutions, but i am interested in standard one
is there some win/xp-os-built-in option to put message on screen and wait
some time for user's respond before continuing?

You should be able to use Windows Scripting Host (WSH).
 
P

Pegasus \(MVP\)

sali said:
Pegasus (MVP) said:
There is no native command in WinXP to achieve this.

does it mean that my win/xp cmd script is badly designed if i need that
feature?
[on win/98 it was solved naturaly]

Yes, I think it is a pity that Microsoft chose not to include a native tool
with Windows 2000/XP that has a functionality similar to the Win9x "choice"
command. AFAIK, you can still use that command on WinXP. It is even more
unfortunate that the VB Script function "Inputbox" does not have a timeout
parameter either. Perhaps foxidrive will expand on his WSH suggestion and
post some sample code.
 
S

sali

Pegasus (MVP) said:
sali said:
Pegasus (MVP) said:
on win/xp, is tehre option to have user's input waitting for some time?

is there some win/xp-os-built-in option to put message on screen and
wait some time for user's respond before continuing?

thnx

There is no native command in WinXP to achieve this.

does it mean that my win/xp cmd script is badly designed if i need that
feature?
[on win/98 it was solved naturaly]

Yes, I think it is a pity that Microsoft chose not to include a native
tool with Windows 2000/XP that has a functionality similar to the Win9x
"choice" command. AFAIK, you can still use that command on WinXP. It is
even more unfortunate that the VB Script function "Inputbox" does not have
a timeout parameter either. Perhaps foxidrive will expand on his WSH
suggestion and post some sample code.


ye, i use choice on win/xp, but when distributing scripts, you must
distribute choice.com also [or take care to have it on system already]

wsh is also ok, but for some simple tasks, wsh is overkill for three-lines
scripts
 
M

Matthias Tacke

sali said:
"Pegasus (MVP)" <[email protected]> je napisao u poruci interesnoj ....
There is no native command in WinXP to achieve this.

does it mean that my win/xp cmd script is badly designed if i need that
feature?
[on win/98 it was solved naturaly]
Hmm - partly,
it means that win nt/2000/xp cmd.exe is badly designed omitting this input
method and you didn't take care of that.
(Choice reappears in Win Server 2003 and Vista)

Benny Pedersen posted a choice replacement written in vbscript.
<http://groups.google.com/group/alt.msdos.batch.nt/msg/738cbcf6368883f7>

Timo Salmi's cmdfaq has an entry on missing choice in XP.
<http://www.netikka.net/tsneti/info/tscmd014.htm>

Norton Utilities always had a BE.exe (Batch Enhancer) with an ASK/timeout
option which still works in win XP.

There are other 3rd party replacements for choice, I like Bill Stewart's
<http://www.westmesatech.com/editv.html>

HTH
Matthias
 
M

Matthias Tacke

If the question is of a simple yes/no type, the wshshell.popup with timeout
option might be used. If not, the question has to be splitted with first
asking if the default "whatever" shall be changed. If the answer is yes
there is a user reaction and the real question may be asked.

Didn't remember that I once posted such a solution myself ;-)
ye, i use choice on win/xp, but when distributing scripts, you must
distribute choice.com also [or take care to have it on system already]

wsh is also ok, but for some simple tasks, wsh is overkill for three-lines
scripts
w2k/xp usually have wsh installed and you can create a wsh script on the
fly from inside a batch - so I don't see overkill íf this is the only way
without 3rd party tools.

HTH
Matthias

PS: Sorry I didn't read your first posting carefully - forget my other reply
 
K

Konrad Kullig

you could use:
set /p MyInput=
where the environment variable "MyInput" is set to the user input.

Regards
Konrad Kullig
 
A

Al Dunbar

Exactly. Funny how people get used to the "convenience" of the limitations
of older versions of windows. CHOICE was a GREAT addition back in the day,
but don't you all remember wanting something more like SET/P, with its lack
of reliance on the ERRORLEVEL variable, and its ability to collect some
meaningful input?

/Al

Konrad Kullig said:
you could use:
set /p MyInput=
where the environment variable "MyInput" is set to the user input.

Regards
Konrad Kullig

sali said:
on win/xp, is tehre option to have user's input waitting for some time?

on win/98 there was command "choice" with option to wait on keypress for
predefined number of secs
on win/xp i have set command "set /p variable=[promptstring] which waits
forever
there is also "pause" which also waits forever.

i know i may use third-party solutions, but i am interested in standard
one
is there some win/xp-os-built-in option to put message on screen and wait
some time for user's respond before continuing?

thnx
 
M

Matthias Tacke

Al said:
Exactly. Funny how people get used to the "convenience" of the limitations
of older versions of windows. CHOICE was a GREAT addition back in the day,
but don't you all remember wanting something more like SET/P, with its lack
of reliance on the ERRORLEVEL variable, and its ability to collect some
meaningful input?
True, but since choice has always been an external program it was arrogant
from MS to not include it in NT/w2k/xp and force people to rely on 3rd
party apps.

BTW the limitations of choice helped to create such good and free tools as
wbat from Horst Schaeffer <http://home.mnet-online.de/horst.muc/main.htm>
which also has the asked for timeout feature.
 
A

Al Dunbar

Matthias Tacke said:
True, but since choice has always been an external program it was arrogant
from MS to not include it in NT/w2k/xp and force people to rely on 3rd
party apps.

I'm not sure if that was caused by arrogance, or a lack of understanding of
the needs of the batch community...

/Al
 
B

billious

Al Dunbar said:
I'm not sure if that was caused by arrogance, or a lack of understanding
of the needs of the batch community...

Which comes down to arrogance - not listening (or looking) because
"Microsoft knows what you need."

There are so many examples - problems that could be easily fixed but have
remained unfixed because Microsoft insists that they have a "one true way"
that must be followed. For instance, the lack of a /u switch to convert
time/dates to universal yymmddhhnnsszzz format, incorporating
enabledelayedexpansion into setlocal rather than being a command in itself,
the leading-zero-is-octal rigmarole (no set /z for maths where a leading 0
is decimal and 0O... is octal), the "skip=0" being an error, failure to
provide appropriate error mesages ("file not found" where "file FILENAME not
found" would be appropriate) and of course even back to fixing the errors
introduced by earlier versions - failure to parse the second argument into
FCB2, for instance. Even the documentation demonstrates this arrogance - the
arrogant assumption that everyone knows C and therefore the C-style
constructs need no explanation; the supreme confidence that means whoever
wrote the documentation doesn't have to spell-check or syntax-check it,
leading to "hexIdecimal" and showing that the writer is unfamiliar with the
use of singular vs plural forms in English.

I'm not sure of course, but it almost seems that reading appropriate ALT
groups is verboten - only the "official" microsoft groups may be read, and
there's so little traffic there (since we insist on assigning it a
ridiculous misleading name, like it was the offspring of some Hollywood
"celebritiy'"...) that it's obviously of no interest.
 
P

Pegasus \(MVP\)

billious said:
Which comes down to arrogance - not listening (or looking) because
"Microsoft knows what you need."

There are so many examples - problems that could be easily fixed but have
remained unfixed because Microsoft insists that they have a "one true way"
that must be followed. For instance, the lack of a /u switch to convert
time/dates to universal yymmddhhnnsszzz format *** Yes!
incorporating enabledelayedexpansion into setlocal rather than being a
command in itself, the leading-zero-is-octal rigmarole (no set /z for
maths where a leading 0 is decimal and 0O... is octal), *** Yes!
the "skip=0" being an error, failure to provide appropriate error mesages
("file not found" where "file FILENAME not found" would be appropriate) *** Yes!
and of course even back to fixing the errors introduced by earlier
versions - failure to parse the second argument into FCB2, for instance.
Even the documentation demonstrates this arrogance - the arrogant
assumption that everyone knows C and therefore the C-style constructs need
no explanation; the supreme confidence that means whoever wrote the
documentation doesn't have to spell-check or syntax-check it, leading to
"hexIdecimal" and showing that the writer is unfamiliar with the use of
singular vs plural forms in English.
*** I find the spelling of MS documents not too bad. Excellent when
*** measured against what you find in newsgroup posts, mediocre when
*** compared against quality publications such as the Scientific American.
I'm not sure of course, but it almost seems that reading appropriate ALT
groups is verboten - only the "official" microsoft groups may be read, and
there's so little traffic there (since we insist on assigning it a
ridiculous misleading name, like it was the offspring of some Hollywood
"celebritiy'"...) that it's obviously of no interest.
*** And how about giving us a decent command line search & replace
*** tool, one that can handle poison characters? And the ability to access
*** paths exceeding 260 characters, without having to resort to work-
*** arounds with substituted drives or shares?
 
A

Al Dunbar

Pegasus (MVP) said:
*** I find the spelling of MS documents not too bad. Excellent when
*** measured against what you find in newsgroup posts, mediocre when
*** compared against quality publications such as the Scientific
American.
*** And how about giving us a decent command line search & replace
*** tool, one that can handle poison characters? And the ability to access
*** paths exceeding 260 characters, without having to resort to work-
*** arounds with substituted drives or shares?

There are certainly some glaring issues pointed out above. Perhaps if MS was
really interested in producing a robust command line/scripting tool, maybe
they would have done more than just tweak the existing BATCH system, and
produced something more than incrementally more powerful. Hint: see the last
word in my post below.

The trouble with enhancing batch further by addressing its shortcomings as a
programming tool is: where do you draw the line? Sure, fix the "08 and 09
are invalid numerical values" problem; but why stop at fixed point
arithmetic? Simplify the processing of long lines of text containing poison
characters by adding utilities to handle them, and you'd then have to
explain why character processing depends on the command used...

I use batch when it is appropriate, but I am less frustrated by it because I
don't expect what it cannot deliver. When I find its limitations too
limiting, I switch to one of the two technologies that were developed in
part to address the weakness of batch as a programming tool: WSH or
PowerShell.

/Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top