home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 16 / 16.iso / t / t239 / 1.img / INPUT.DOC < prev    next >
Encoding:
Text File  |  1993-11-02  |  24.6 KB  |  550 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.         
  8.                             
  9.                             
  10.                             
  11.                             
  12.                             
  13.                             
  14.                             
  15.                             
  16.                             
  17.                             
  18.                             
  19.                             
  20.                             
  21.                             
  22.                             
  23.                             
  24.                                STEENBURGH'S STUFF
  25.                             Mildly Useful Utilities
  26.                                 For Batch Files
  27.                                  Version  3.0
  28.           Copyright 1991-1993 by Chuck Steenburgh and Tay-Jee Software
  29.         
  30.                              _______
  31.                         ____|__     |               (TM)
  32.                      --|       |    |-------------------
  33.                        |   ____|__  |  Association of
  34.                        |  |       |_|  Shareware
  35.                        |__|   o   |    Professionals
  36.                      -----|   |   |---------------------
  37.                           |___|___|    MEMBER
  38.         
  39.         
  40.         
  41.         
  42.         
  43.         
  44.         
  45.         
  46.         
  47.         
  48.         
  49.         
  50.         
  51.         
  52.         
  53.         
  54.         
  55.         
  56.         
  57.         
  58.         
  59.         
  60.         
  61.  
  62.                                      Page 1
  63.  
  64.  
  65.  
  66.  
  67.  
  68.         INPUT v3.13                                                     |
  69.         Copyright 1991-1993 Chuck Steenburgh & Tay-Jee Software
  70.         
  71.            If you use batch files very often, you've probably acquired
  72.         a program called ASK.COM or QUERY.COM or something similar 
  73.         that allows you to ask questions and receive simple responses.
  74.         Usually, this involves typing an ECHO command with your
  75.         question, followed by ASK.COM or whatever.  If you do this
  76.         a lot, you will probably appreciate the fact the INPUT.EXE
  77.         will accomplish the jobs of both the ECHO and ASK commands.
  78.         Add to this the greater flexibility that INPUT.EXE offers
  79.         in presenting your prompt to the user and in receiving input,
  80.         and you'll be sold.
  81.         
  82.         Usage: INPUT ["prompt"] [nnn] [Options]
  83.                      
  84.         
  85.                   "prompt"        Enter the text you would like to
  86.                                   appear to prompt the user for
  87.                                   input.  This can be up to 59 char-
  88.                                   acters and must be enclosed in
  89.                                   quotation marks.
  90.         
  91.                   nnn             Enter a number representing the   
  92.                                   color in which you want your mes-
  93.                                   sage to appear.  You must, of
  94.                                   course, have a color monitor and
  95.                                   card.  See Appendix 3.
  96.            
  97.            Options:
  98.                   
  99.                   /a|A[+|-]       color Attribute selection.  When the  |
  100.                                   lower-case "a" is used, input is re-  |
  101.                                   stricted to the eight "normal" color  |
  102.                                   attributes (0-7).  When the upper-case|
  103.                                   "A" is used, input is restricted to   |
  104.                                   color attributes 0-16.  Including the |
  105.                                   "+" or "-" signs after the switch will|
  106.                                   display the available colors above or |
  107.                                   below the prompt, respectively.       |
  108.                   
  109.                   /B[+|-]         fix trailing Backslash.  /B+ concat-  |
  110.                                   enates a trailing backslash to the    |
  111.                                   end of the input string if not al-    |
  112.                                   ready present.  /B- removes any trail-|
  113.                                   ing backslash present.                |
  114.                                   
  115.         
  116.                   /C              Center output.  Include this switch   |
  117.                                   if you want your prompt message cen-  |
  118.                                   tered on the current line.            |
  119.                   
  120.                   /D              display list of available Disk drives
  121.                                   on current system and restrict input
  122.  
  123.                                      Page 2
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                   to one of these letters.
  130.                   
  131.                   /Exxxxxx        Execute command.  Instead of returning|
  132.                                   errorlevel, accept text input which is|
  133.                                   supplied to command "xxxxxx."         |
  134.                   
  135.                   /F[nn]          Fixed input field of length nn.  INPUT|
  136.                                   will display a fixed, editable input  |
  137.                                   field of length nn for accepting data.|
  138.                                   Cursor arrow, insert/delete, home/end,|
  139.                                   and TAB keys are active in this field.|
  140.                                   If used in conjunction with the /M    |
  141.                                   switch, the current value for the en- |
  142.                                   vironment variable (if any) is dis-   |
  143.                                   played in the field as a default.     |
  144.                                   When this switch is used, TWO color   |
  145.                                   values may be specified.  If more than|
  146.                                   one is used, the FIST is the color of |
  147.                                   the input field, and the second is the|
  148.                                   color of the prompt.                  |
  149.                                   
  150.                   /H or /?        display brief Help screen.
  151.                   
  152.                   /I              use this for a case-Insensitive error
  153.                                   level return.  If this switch is
  154.                                   included on the command line, pressing
  155.                                   a letter a-z (lower case) will return
  156.                                   the same value as if the corresponding
  157.                                   key A-Z (upper case) were pressed.
  158.                   
  159.                   /Kxxxx          restrict Keypress.  When followed by  |
  160.                                   a list of characters, INPUT will only |
  161.                                   accept those characters, issuing a    |
  162.                                   warning tone when any other key (ex-  |
  163.                                   cept ESC) is pressed.  The errorlevel |
  164.                                   value returned will equal the ordinal |
  165.                                   position of the selected character in |
  166.                                   the list.                             |
  167.                   
  168.                   /Ln             Leftmost column in which prompt should
  169.                                   appear.
  170.                   
  171.                   /Mxxxxxx        receive text input and set Master en-
  172.                                   vironment variable xxxxxx with data 
  173.                                   received.  Defaults to variable name 
  174.                                   of INPUT if no name is provided.
  175.                   
  176.                   /Oxxxxx         cOncatenate "xxxxxx" to end of data   |
  177.                                   entered.  Valid only for string input |
  178.                                   options /M and /F.  Adds the specified|
  179.                                   characters to the end of the value en-|
  180.                                   tered by the user.  If you must in-   |
  181.                                   clude spaces, enclose the whole switch|
  182.                                   in quotes.                            |
  183.  
  184.                                      Page 3
  185.  
  186.  
  187.  
  188.  
  189.  
  190.                                   
  191.                   /Pd             Pause 10 seconds for user input, then 
  192.                                   default to "d" (where "d" is any char-
  193.                                   acter.  INPUT will wait up 10 seconds 
  194.                                   for user input.  If no key is pressed 
  195.                                   within 10 seconds, INPUT will act as  
  196.                                   if the key specified by the key rep-  
  197.                                   resented by the single character "d"  
  198.                                   was pressed.  Note that all other     
  199.                                   switches (case insensitivity, yes/no  
  200.                                   answer, etc.) remain active if time   
  201.                                   expires and the default key is used.  
  202.                                   INPUT adds a warning that it will de- 
  203.                                   fault to the specified value after 10 
  204.                                   seconds, and will display a succession
  205.                                   of ten dots to indicate elapsed time. 
  206.                                   
  207.                   /Q              Quiet mode.  Suppresses the audible
  208.                                   alarm prompt.
  209.                   
  210.                   /Rn             Row in which prompt should appear.
  211.                                   
  212.                   /S              Show keypress.  Adding this switch
  213.                                   will cause INPUT to display the
  214.                                   errorlevel value returned.  Use this
  215.                                   for quick "debugging" of your use
  216.                                   of INPUT
  217.                   
  218.                   /V              instead of a single keypress, causes  
  219.                                   INPUT to read a numeric Value (con-   
  220.                                   cluded with a carriage return) between
  221.                                   0 and 255 from the keyboard.  Values
  222.                                   less than 0 will return 0 and values
  223.                                   greater than 255 will return 255.
  224.                                   
  225.                   /Wn             when used in conjunction with the /P
  226.                                   switch, changes the default Wait time
  227.                                   to n seconds, where n is no greater
  228.                                   than 999 seconds.
  229.                   
  230.                   /X              When used in conjunction with the /W 
  231.                                   and/or /P switches will suppress dis-
  232.                                   play of the default value and timer  
  233.                                   "ticks."
  234.                                   
  235.                   /Y              use this for a Yes-no only response.  
  236.                                   If the "n" key is pressed, errorlevel 
  237.                                   of "0" is returned; pressing any other
  238.                                   key returns an errorlevel of 1.  The  
  239.                                   prompt "(Y/n)" is appended to the nor-
  240.                                   mal prompt specified by the user.     
  241.                                   
  242.                   /N              Use this for a yes-No only response.  
  243.                                   If the "y" key is pressed, errorlevel 
  244.  
  245.                                      Page 4
  246.  
  247.  
  248.  
  249.  
  250.  
  251.                                   of "1" is returned; pressing any other
  252.                                   key returns an errorlevel of 0.  The  
  253.                                   prompt "(y/N)" is appended to the nor-
  254.                                   mal prompt specified by the user.     
  255.                                   This switch takes precedence over the 
  256.                                   /y switch.                            
  257.                                   
  258.                   The command line parameters may be entered in any 
  259.                   order, may be in any case, and may be preceded by 
  260.                   either the "/" or "-" character.     
  261.         
  262.         Examples:
  263.         
  264.              INPUT "Select a number from one to 10"
  265.         
  266.              This prints the text "Select on number from one to 10"
  267.         on the current line and waits for a keypress.
  268.         
  269.              INPUT "Press any key to continue" 79
  270.         
  271.              This prints the text "Press any key to continue" on the
  272.         current line in bright white on a red background and waits
  273.         for a keypress.
  274.         
  275.              INPUT "Press the space bar to exit" 143 /c
  276.         
  277.              This prints the text "Press the space bar to exit" cen-
  278.         tered on the current line in flashing bright white on a black
  279.         background.
  280.         
  281.              INPUT /s /i "Press any key..." /c 14
  282.              
  283.              Prompts user with "Press any key..." in yellow on black.
  284.         Returns a case-insensitive errorlevel and displays it on the
  285.         screen before terminating.
  286.         
  287.              INPUT "Do you wish to continue?" /s 79 /y              
  288.              
  289.              Prompts user with "Do you wish to continue? (Y/n)" in 
  290.         white on red.  Returns errorlevel of 1 unless the "n" key is
  291.         pressed.  Displays errorlevel on screen.
  292.         
  293.              INPUT "Press any key..." /pf                               
  294.              
  295.              Prompts user with "Press any key... (defaults to f after 
  296.         10 seconds)" in black on white.  Returns errorlevel of 102 if   
  297.         no key is pressed within 10 seconds, otherwise returns value of 
  298.         key pressed.
  299.         
  300.              INPUT "Press any key..." /c /pf                         
  301.              
  302.              Prompts user with "Press any key... (defaults to f after   
  303.         10 seconds)" in black on white.  Returns errorlevel of 70 if no 
  304.         key is pressed within 10 seconds, otherwise returns the upper   
  305.  
  306.                                      Page 5
  307.  
  308.  
  309.  
  310.  
  311.  
  312.         case ASCII value of the key pressed.                           
  313.         
  314.              INPUT "Enter data:" /p1 /w15 /q 30
  315.              
  316.              Prompts user with "Enter data: (defaults to 1 after 15
  317.         seconds)" in yellow on blue.  Returns errorlevel of 49 if no
  318.         key is pressed after 15 seconds, otherwise returns the error-
  319.         level of the key pressed.  The alarm does NOT sound.
  320.         
  321.              INPUT "How many copies should be printed? " /v /c
  322.              
  323.              Prompts user with "How many copies should be printed?"
  324.         centered on the current line.  A number can be entered by the
  325.         user and INPUT will return an errorlevel equal to the number
  326.         entered (between 0 and 255).  If the /V switch is used, the
  327.         data entered by the user will appear on screen, and can be
  328.         changed using backspace before pressing <Return>.
  329.         
  330.              INPUT "Press any key to continue..." /p /x
  331.              
  332.              Displays the familiar DOS PAUSE message, but exits after
  333.         a 10 second delay if no key is pressed.  An errorlevel of 0 is
  334.         returned.
  335.         
  336.              INPUT "Switch to which drive?" /D
  337.              
  338.              Displays prompt "Switch to which drive?" followed by a
  339.         list of all valid drives on the system.  Will not exit until
  340.         one of these drive letters is pressed.
  341.         
  342.              INPUT "Enter a directory mask " /Edir /C
  343.              
  344.              Centers prompt "Enter a directory mask " on screen.  Exe-
  345.         cutes DOS "dir" command, using any text entered in response to
  346.         prompt as arguments.  For example, if user typed "*.exe /p" the
  347.         command "dir *.exe /p" will be executed by INPUT.  This allows
  348.         INPUT to be used to enter limited string data.
  349.         
  350.             INPUT "Enter a file name: " /MFILENAME
  351.             
  352.             Accepts text data from keyboard and places value entered
  353.         in the master environment in a variable named "filename."  This
  354.         value can later be accessed within a batch file or via other
  355.         programs.
  356.         
  357.              INPUT "New PATH: " /MPATH /F60                             |
  358.              
  359.            Displays the current PATH setting in a fixed-length field 60 |
  360.         characters wide.  It may then be edited and saved by pressing   |
  361.         ENTER.                                                          |
  362.         
  363.              INPUT "Select an option: " /KABC                           |
  364.         
  365.            Returns an errorlevel of 1 if A is pressed, 2 if B, and 3 if |
  366.  
  367.                                      Page 6
  368.  
  369.  
  370.  
  371.  
  372.  
  373.         C is pressed.  Sounds a beep if any other key is pressed and    |
  374.         waits for valid keypress or ESC.                                |
  375.         
  376.              CD | INPUT /MDIR /Q                                        |
  377.         
  378.            In this redirection example, the output of the "CD" command  |
  379.         is "piped" into INPUT, which stores in information in an envir- |
  380.         onment variable called DIR.  (The CD command entered by ltself  |
  381.         displays the current drive and directory name.)  The output of  |
  382.         virtually any command can be stored in the environment using    |
  383.         INPUT in this manner.                                           |
  384.         
  385.            INPUT will also sound an alarm to let the user know that
  386.         a response is expected (unless /Q switch specified).
  387.         
  388.            When a key is pressed, INPUT will set the errorlevel equal
  389.         to the ASCII value of the key pressed.  This is slightly dif-
  390.         ferent from BATBOX in that in normal operation INPUT is case
  391.         sensitive and will allow you to distinguish between upper and
  392.         lower case letters.  If you want a case-insensitive return, use
  393.         the /i switch.  See Appendix 2 for a complete list of the ASCII
  394.         characters theoretically supported by INPUT.  If the /H or /?
  395.         parameter was specified, the errorlevel returned will be 255.
  396.         
  397.            If the ESC key is pressed, an errorlevel of 254 will be re-
  398.         turned.
  399.         
  400.            When using the /E parameter to execute a batch file, be sure
  401.         to include the extension ".BAT" as part of the switch.
  402.         
  403.            When using the /M switch to set an environment variable, the
  404.         variable name you supply will be converted to upper case.  DOS
  405.         will only recognize upper case variables within batch files.
  406.         
  407.            When using the /M switch in conjunction with /Y or /N, the
  408.         variable will be assigned a value of YES or NO as appropriate.
  409.         
  410.            SPECIAL NOTE TO 4DOS* and NDOS USERS                         |
  411.            
  412.            INPUT.EXE conflicts with 4DOS' INPUT internal command.  To
  413.         remedy this situation, create a batch file containing the two
  414.         lines below (or add them to your AUTOEXEC.BAT file) and execute
  415.         once each time your computer is turned on:
  416.         
  417.              alias input d:\path\input.exe
  418.              alias inp4 *input
  419.              
  420.            The first line creates an alias of "input" for the program 
  421.         INPUT.EXE.  The second line creates an alias of "inp4" for the
  422.         internal 4DOS INPUT command.  Make sure the "d:\path\" part of
  423.         the first line is replaced with the actual drive/path in which
  424.         INPUT.EXE is located on your system.  Since INPUT performs many
  425.         more functions than the 4DOS command, it is desirable to
  426.         avoid any confusion and simply replace 4DOS' INPUT command.
  427.  
  428.                                      Page 7
  429.  
  430.  
  431.  
  432.  
  433.  
  434.         
  435.         * 4DOS is a registered trademark of JP Software Inc.
  436.          
  437.         OMBUDSMAN
  438.         
  439.           This program is produced by a member of the Association of
  440.         Shareware Professionals (ASP).  ASP wants to make sure that
  441.         the shareware principle works for you.  If you are unable to
  442.         resolve a shareware-related problem with an ASP member by
  443.         contacting the member directly, ASP may be able to help.  The
  444.         ASP Ombudsman can help you resolve a dispute or problem with
  445.         an ASP member, but does not provide technical support for 
  446.         members' products.  Please write to the ASP Ombudsman at 545
  447.         Grover Road, Muskegon, MI 49442 or send a CompuServe message
  448.         via CompuServe Mail to ASP Ombudsman, 70007,3536.
  449.         
  450.         
  451.         DISCLAIMER
  452.         
  453.            The programs described in this documentation are guaran-
  454.         teed to do absolutely nothing!  They have, however, in my exper-
  455.         ience performed essentially as described herein.  The author
  456.         will not be responsible for any loss or damages caused through
  457.         the use of these programs.  No warranty, express or implied,
  458.         is provided for this software's performance, merchantability,
  459.         or fitness for a particular purpose.
  460.         
  461.            All trademarks are property of their respective owners.
  462.         
  463.            The programs and documentation are Copyright 1991,1992 by 
  464.         Chuck Steenburgh.  You are encouraged to distribute these pro-
  465.         grams provided the following conditions are met:
  466.         
  467.            - all files contained in the archive or distribution disk
  468.              must be distributed together in UNMODIFIED form
  469.         
  470.            - you charge no more than a reasonable fee for copying or
  471.              subscription, and clearly indicate that payment of such
  472.              a fee does NOT grant ownership of the programs.
  473.         
  474.            This program is part of set of utilities known as STEEN-
  475.         BURGH'S STUFF (Mildly Useful Utilities).  The full set of
  476.         utilities includes the following programs:
  477.         
  478.              BATBOX:     Simple menu creation/input system
  479.              CHKDRV:     Checks disk drive status
  480.              CHKPRN:     Checks parallel printer status
  481.              CLK:        Displays time on screen
  482.              CURSOR:     Change cursor shape
  483.              DOSVER:     Checks for DOS version currently running
  484.              INPUT:      Simple prompt/input system
  485.              KLS:        Colorful screen-clearing utility
  486.              LAUNCHER:   File selection/execution system
  487.              MUSIC:      Plays transcribed sheet music on the PC
  488.  
  489.                                      Page 8
  490.  
  491.  
  492.  
  493.  
  494.  
  495.              RAND:       Random number generator
  496.              SKIP:       Prints blank lines from batch files
  497.              SOUNDER:    Wide range of noise making options
  498.              SPACE:      File/disk space reporting utility
  499.              WAITFOR:    Timed pauses 
  500.              WHENISIT:   Date/time telling utility
  501.              WRITE:      Colorful output anywhere on screen
  502.              XD:         Create/switch directories at the same time
  503.         
  504.            You may evaluate these programs for up to 30 days on a free
  505.         trial basis.  After 30 days, you should register your use of
  506.         these programs.  The registration fee is $20, payable to the
  507.         author at the address given below.  For those registering
  508.         directly with Tay-Jee Software, we offer a $5 cash discount.
  509.         
  510.            Let's be real: I don't plan to make a lot of money this way.
  511.         Registration does have its advantages:
  512.         
  513.            - I am improving these programs all the time.  Registration
  514.              will get you IMMEDIATELY a disk with the latest version.
  515.              You will also get the next major release of the program set
  516.              sent to you free of charge.
  517.         
  518.            - While I can't promise to include everyone's suggestions
  519.              in program updates, you can bet I'll listen to registered
  520.              users before any of you scrounges out there.
  521.         
  522.            - You will make me feel all warm and fuzzy and appreciated, 
  523.              and all that good stuff.
  524.         
  525.            - You will also get an evaluation copy of my text file for-
  526.              matting program (used to produce the margins in this doc-
  527.              ument), and any other electronic creations I have decided
  528.              to unleash on a foolish, unsuspecting world.
  529.         
  530.            Send comments/registrations to:
  531.         
  532.                 Tay-Jee Software
  533.                 Post Office Box 835
  534.                 Lexington, VA 24450
  535.                 (703)464-5290
  536.                 
  537.                 !!!VIRGINIA RESIDENTS ADD 4.5SALES TAX!!!
  538.         
  539.                 CIS 72330,1776 (I haunt the IBMSYS and IBMPRO forums)
  540.         
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.                                      Page 9