home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 17
/
CD_ASCQ_17_101194.iso
/
vrac
/
input321.zip
/
INPUT.DOC
< prev
next >
Wrap
Text File
|
1994-08-08
|
25KB
|
606 lines
STEENBURGH'S STUFF
Mildly Useful Utilities
For Batch Files
Version 3.0
Copyright 1991-1993 by Chuck Steenburgh and Tay-Jee Software
_______
____|__ | (TM)
--| | |-------------------
| ____|__ | Association of
| | |_| Shareware
|__| o | Professionals
-----| | |---------------------
|___|___| MEMBER
Page 1
INPUT v3.21 |
Copyright 1991-1994 Chuck Steenburgh & Tay-Jee Software
If you use batch files very often, you've probably acquired
a program called ASK.COM or QUERY.COM or something similar
that allows you to ask questions and receive simple responses.
Usually, this involves typing an ECHO command with your
question, followed by ASK.COM or whatever. If you do this
a lot, you will probably appreciate the fact the INPUT.EXE
will accomplish the jobs of both the ECHO and ASK commands.
Add to this the greater flexibility that INPUT.EXE offers
in presenting your prompt to the user and in receiving input,
and you'll be sold.
Usage: INPUT ["prompt"] [nnn] [Options]
"prompt" Enter the text you would like to
appear to prompt the user for
input. This can be up to 59 char-
acters and must be enclosed in
quotation marks.
nnn Enter a number representing the
color in which you want your mes-
sage to appear. You must, of
course, have a color monitor and
card. See Appendix 3.
Options:
/a|A[+|-] color Attribute selection. When the
lower-case "a" is used, input is re-
stricted to the eight "normal" color
attributes (0-7). When the upper-case
"A" is used, input is restricted to
color attributes 0-16. Including the
"+" or "-" signs after the switch will
display the available colors above or
below the prompt, respectively.
/B[+|-] fix trailing Backslash. /B+ concat-
Page 2
enates a trailing backslash to the
end of the input string if not al-
ready present. /B- removes any trail-
ing backslash present.
/C Center output. Include this switch
if you want your prompt message cen-
tered on the current line.
/D display list of available Disk drives
on current system and restrict input
to one of these letters.
/Exxxxxx Execute command. Instead of returning
errorlevel, accept text input which is
supplied to command "xxxxxx."
/F[nn] Fixed input field of length nn. INPUT
will display a fixed, editable input
field of length nn for accepting data.
Cursor arrow, insert/delete, home/end,
and TAB keys are active in this field.
If used in conjunction with the /M
switch, the current value for the en-
vironment variable (if any) is dis-
played in the field as a default.
When this switch is used, TWO color |
values may be specified. If more than|
one is used, the FIRST is the color of|
the prompt, and the second is the |
color of the input field. |
/H or /? display brief Help screen.
/I use this for a case-Insensitive error
level return. If this switch is
included on the command line, pressing
a letter a-z (lower case) will return
the same value as if the corresponding
key A-Z (upper case) were pressed.
/Kxxxx restrict Keypress. When followed by
a list of characters, INPUT will only
accept those characters, issuing a
warning tone when any other key (ex-
cept ESC) is pressed. The errorlevel
value returned will equal the ordinal
Page 3
position of the selected character in
the list.
/Ln Leftmost column in which prompt should
appear.
/Mxxxxxx receive text input and set Master en-
vironment variable xxxxxx with data
received. Defaults to variable name
of INPUT if no name is provided.
/Oxxxxx cOncatenate "xxxxxx" to end of data
entered. Valid only for string input
options /M and /F. Adds the specified
characters to the end of the value en-
tered by the user. If you must in-
clude spaces, enclose the whole switch
in quotes.
/Pd Pause 10 seconds for user input, then
default to "d" (where "d" is any char-
acter. INPUT will wait up 10 seconds
for user input. If no key is pressed
within 10 seconds, INPUT will act as
if the key specified by the key rep-
resented by the single character "d"
was pressed. Note that all other
switches (case insensitivity, yes/no
answer, etc.) remain active if time
expires and the default key is used.
INPUT adds a warning that it will de-
fault to the specified value after 10
seconds, and will display a succession
of ten dots to indicate elapsed time.
/Q Quiet mode. Suppresses the audible
alarm prompt.
/Rn Row in which prompt should appear.
/S Show keypress. Adding this switch
will cause INPUT to display the
errorlevel value returned. Use this
for quick "debugging" of your use
of INPUT
/V instead of a single keypress, causes
INPUT to read a numeric Value (con-
Page 4
cluded with a carriage return) between
0 and 255 from the keyboard. Values
less than 0 will return 0 and values
greater than 255 will return 255.
/Wn when used in conjunction with the /P
switch, changes the default Wait time
to n seconds, where n is no greater
than 999 seconds.
/X When used in conjunction with the /W
and/or /P switches will suppress dis-
play of the default value and timer
"ticks."
/Y use this for a Yes-no only response.
If the "n" key is pressed, errorlevel
of "0" is returned; pressing any other
key returns an errorlevel of 1. The
prompt "(Y/n)" is appended to the nor-
mal prompt specified by the user.
/N Use this for a yes-No only response.
If the "y" key is pressed, errorlevel
of "1" is returned; pressing any other
key returns an errorlevel of 0. The
prompt "(y/N)" is appended to the nor-
mal prompt specified by the user.
This switch takes precedence over the
/y switch.
The command line parameters may be entered in any
order, may be in any case, and may be preceded by
either the "/" or "-" character.
Examples:
INPUT "Select a number from one to 10"
This prints the text "Select on number from one to 10"
on the current line and waits for a keypress.
INPUT "Press any key to continue" 79
This prints the text "Press any key to continue" on the
current line in bright white on a red background and waits
for a keypress.
Page 5
INPUT "Press the space bar to exit" 143 /c
This prints the text "Press the space bar to exit" cen-
tered on the current line in flashing bright white on a black
background.
INPUT /s /i "Press any key..." /c 14
Prompts user with "Press any key..." in yellow on black.
Returns a case-insensitive errorlevel and displays it on the
screen before terminating.
INPUT "Do you wish to continue?" /s 79 /y
Prompts user with "Do you wish to continue? (Y/n)" in
white on red. Returns errorlevel of 1 unless the "n" key is
pressed. Displays errorlevel on screen.
INPUT "Press any key..." /pf
Prompts user with "Press any key... (defaults to f after
10 seconds)" in black on white. Returns errorlevel of 102 if
no key is pressed within 10 seconds, otherwise returns value of
key pressed.
INPUT "Press any key..." /c /pf
Prompts user with "Press any key... (defaults to f after
10 seconds)" in black on white. Returns errorlevel of 70 if no
key is pressed within 10 seconds, otherwise returns the upper
case ASCII value of the key pressed.
INPUT "Enter data:" /p1 /w15 /q 30
Prompts user with "Enter data: (defaults to 1 after 15
seconds)" in yellow on blue. Returns errorlevel of 49 if no
key is pressed after 15 seconds, otherwise returns the error-
level of the key pressed. The alarm does NOT sound.
INPUT "How many copies should be printed? " /v /c
Prompts user with "How many copies should be printed?"
centered on the current line. A number can be entered by the
user and INPUT will return an errorlevel equal to the number
entered (between 0 and 255). If the /V switch is used, the
data entered by the user will appear on screen, and can be
changed using backspace before pressing <Return>.
Page 6
INPUT "Press any key to continue..." /p /x
Displays the familiar DOS PAUSE message, but exits after
a 10 second delay if no key is pressed. An errorlevel of 0 is
returned.
INPUT "Switch to which drive?" /D
Displays prompt "Switch to which drive?" followed by a
list of all valid drives on the system. Will not exit until
one of these drive letters is pressed.
INPUT "Enter a directory mask " /Edir /C
Centers prompt "Enter a directory mask " on screen. Exe-
cutes DOS "dir" command, using any text entered in response to
prompt as arguments. For example, if user typed "*.exe /p" the
command "dir *.exe /p" will be executed by INPUT. This allows
INPUT to be used to enter limited string data.
INPUT "Enter a file name: " /MFILENAME
Accepts text data from keyboard and places value entered
in the master environment in a variable named "filename." This
value can later be accessed within a batch file or via other
programs.
INPUT "New PATH: " /MPATH /F60
Displays the current PATH setting in a fixed-length field 60
characters wide. It may then be edited and saved by pressing
ENTER.
INPUT "Select an option: " /KABC
Returns an errorlevel of 1 if A is pressed, 2 if B, and 3 if
C is pressed. Sounds a beep if any other key is pressed and
waits for valid keypress or ESC.
CD | INPUT /MDIR /Q
In this redirection example, the output of the "CD" command
is "piped" into INPUT, which stores in information in an envir-
onment variable called DIR. (The CD command entered by ltself
displays the current drive and directory name.) The output of
virtually any command can be stored in the environment using
INPUT in this manner.
Page 7
INPUT will also sound an alarm to let the user know that
a response is expected (unless /Q switch specified).
When a key is pressed, INPUT will set the errorlevel equal
to the ASCII value of the key pressed. This is slightly dif-
ferent from BATBOX in that in normal operation INPUT is case
sensitive and will allow you to distinguish between upper and
lower case letters. If you want a case-insensitive return, use
the /i switch. See Appendix 2 for a complete list of the ASCII
characters theoretically supported by INPUT. If the /H or /?
parameter was specified, the errorlevel returned will be 255.
If the ESC key is pressed, an errorlevel of 254 will be re-
turned.
When using the /E parameter to execute a batch file, be sure
to include the extension ".BAT" as part of the switch.
When using the /M switch to set an environment variable, the
variable name you supply will be converted to upper case. DOS
will only recognize upper case variables within batch files.
When using the /M switch in conjunction with /Y or /N, the
variable will be assigned a value of YES or NO as appropriate.
SPECIAL NOTE TO 4DOS* and NDOS USERS
INPUT.EXE conflicts with 4DOS' INPUT internal command. To
remedy this situation, create a batch file containing the two
lines below (or add them to your AUTOEXEC.BAT file) and execute
once each time your computer is turned on:
alias input d:\path\input.exe
alias inp4 *input
The first line creates an alias of "input" for the program
INPUT.EXE. The second line creates an alias of "inp4" for the
internal 4DOS INPUT command. Make sure the "d:\path\" part of
the first line is replaced with the actual drive/path in which
INPUT.EXE is located on your system. Since INPUT performs many
more functions than the 4DOS command, it is desirable to
avoid any confusion and simply replace 4DOS' INPUT command.
* 4DOS is a registered trademark of JP Software Inc.
OMBUDSMAN
This program is produced by a member of the Association of
Page 8
Shareware Professionals (ASP). ASP wants to make sure that
the shareware principle works for you. If you are unable to
resolve a shareware-related problem with an ASP member by
contacting the member directly, ASP may be able to help. The
ASP Ombudsman can help you resolve a dispute or problem with
an ASP member, but does not provide technical support for
members' products. Please write to the ASP Ombudsman at 545
Grover Road, Muskegon, MI 49442 or send a CompuServe message
via CompuServe Mail to ASP Ombudsman, 70007,3536.
DISCLAIMER
The programs described in this documentation are guaran-
teed to do absolutely nothing! They have, however, in my exper-
ience performed essentially as described herein. The author
will not be responsible for any loss or damages caused through
the use of these programs. No warranty, express or implied,
is provided for this software's performance, merchantability,
or fitness for a particular purpose.
All trademarks are property of their respective owners.
The programs and documentation are Copyright 1991-1994 by
Chuck Steenburgh & Tay-Jee Software. You are encouraged to
distribute these programs provided the following conditions are
met:
- all files contained in the archive or distribution disk
must be distributed together in UNMODIFIED form
- you charge no more than a reasonable fee for copying or
subscription, and clearly indicate that payment of such
a fee does NOT grant ownership of the programs.
This program is part of set of utilities known as STEEN-
BURGH'S STUFF (Mildly Useful Utilities). The full set of
utilities includes the following programs:
BATBOX: Simple menu creation/input system
CHKDRV: Checks disk drive status
CHKPRN: Checks parallel printer status
CLK: Displays time on screen
CURSOR: Change cursor shape
DOSVER: Checks for DOS version currently running
INPUT: Simple prompt/input system
KLS: Colorful screen-clearing utility
LAUNCHER: File selection/execution system
Page 9
MUSIC: Plays transcribed sheet music on the PC
RAND: Random number generator
SKIP: Prints blank lines from batch files
SOUNDER: Wide range of noise making options
SPACE: File/disk space reporting utility
WAITFOR: Timed pauses
WHENISIT: Date/time telling utility
WRITE: Colorful output anywhere on screen
XD: Create/switch directories at the same time
You may evaluate these programs for up to 30 days on a free
trial basis. After 30 days, you should register your use of
these programs. The registration fee is $19.95, payable to the
author at the address given below.
Registration has the following advantages:
- I am improving these programs all the time. Registration
will get you IMMEDIATELY a disk with the latest versions
of the FULL SET of 21 utilities.
- While I can't promise to include everyone's suggestions
in program updates, you can bet I'll listen to registered
users before any of you scrounges out there.
- You will make me feel all warm and fuzzy and appreciated,
and all that good stuff.
- You will also get an evaluation copy of my text file for-
matting program (used to produce the margins in this doc-
ument), and any other electronic creations I have decided
to unleash on a foolish, unsuspecting world.
- You become eligible for special offers, discounts, and
other goodies from all sorts of nice folks. See the file
COUPON.TXT, or call us at (800)378-3966 for details.
- You will be in compliance with the laws of the United
States and international treaties. Spending years in
jail and paying 000s of dollars in fines just for using
someone's computer program without paying for it isn't
a fun thought! (OK, the shareware police won't track
you down, but you get the idea...if you use it, and it's
worth it, pay for it! Only fair, right?)
Send comments/registrations to:
Tay-Jee Software
Page 10
Post Office Box 835
Lexington, VA 24450-0835
(703)261-7023
!!!VIRGINIA RESIDENTS ADD 4.5SALES TAX!!!
!!!ORDERS OUTSIDE NORTH AMERICA ADD $5 SHIPPING!!!
CIS 72330,1776 (I haunt the IBMSYS and IBMPRO forums)
Page 11