home *** CD-ROM | disk | FTP | other *** search
/ norge.freeshell.org (192.94.73.8) / 192.94.73.8.tar / 192.94.73.8 / pub / computers / pcjr / utility / DRNU451.LZH / NUBEASK < prev    next >
Text File  |  1990-10-19  |  5KB  |  120 lines

  1.  
  2.                                    BE ASK 
  3.  
  4.  
  5.  
  6. Description:   Displays a prompt message and then awaits single-key input.
  7.                You can supply a list of keys that defines the key response BE
  8.                ASK will accept, a default key value, a timeout period, and
  9.                color attributes for the prompt message. If you provide
  10.                (keylist), BE ASK returns ERRORLEVEL, which you can test with
  11.                an IF batch command to control the flow of commands in a batch
  12.                command file. If you are nesting BE ASK commands within a menu
  13.                system, you can adjust the ERRORLEVEL that is returned to
  14.                discover which menu set the returned code. 
  15.  
  16.  
  17.  
  18. Syntax:        Version 4.5:   BE ASK "(prompt)" [[,](keylist)]
  19.                               [DEFAULT=(key)] [TIMEOUT=(n)] [ADJUST=(n)]
  20.                               [[BLINKING]  [BRIGHT | BOLD] [(text-color)]
  21.                               [[ON] (back-color)]] 
  22.  
  23.  
  24.  
  25.                                 Parameters: 
  26.  
  27.  
  28.  
  29. (prompt)       A character string BE ASK displays while waiting for input.
  30.                You must enclose the prompt in quote marks if it includes one
  31.                or more blank spaces. If the prompt contains a single-quote
  32.                character, enclose the prompt in double-quote marks. If the
  33.                prompt contains a double-quote character, enclose the prompt
  34.                in single-quote marks. 
  35.  
  36. (keylist)      A list of the character keys, number keys, or symbol keys that
  37.                ASK will accept as a response. The list must be a single
  38.                string of characters with no spaces between them (Example:
  39.                ABCD, not A B C D). When you supply (keylist), BE ASK sets the
  40.                ERRORLEVEL based on the position in the list of the key you
  41.                choose;. Using the above example, pressing A sets ERRORLEVEL
  42.                equal to 1, pressing B sets ERRORLEVEL equal to 2, and so on.
  43.                If you do not specify (keylist), pressing any key completes
  44.                execution of BE ASK with ERRORLEVEL set to 0. 
  45.  
  46. Example:       BE ASK ABCD - If a user chooses "C", ERRORLEVEL will be set to
  47.                3.
  48.  
  49.  
  50. DEFAULT=(key)  The default key value in (keylist) that BE ASK uses if the
  51.                optional timeout elapses or if you press Enter. 
  52.  
  53. TIMEOUT=(n)    A time period, in seconds, that BE ASK waits prior to
  54.                proceeding. If you specify a default key and if the time
  55.                period expires, BE ASK returns the  ERRORLEVEL value
  56.                corresponding to that key. If you do not specify a default
  57.                key, BE ASK sets the ERRORLEVEL value of the *last key* in
  58.                (keylist); if you do not specify (keylist), BE ASK sets a
  59.                value of 0. 
  60.  
  61. ADJUST=(n)     A numeric value BE ASK adds to the returned ERRORLEVEL code to
  62.                adjust for stacked menus. 
  63.  
  64. BLINKING       Causes the prompt message to blink on and off. On some
  65.                monitors this keyword works only if you specify (back-color). 
  66.  
  67. BRIGHT | BOLD  Displays the prompt message as high intensity. 
  68.  
  69. (text-color)   The color of the prompt message text and a response character.
  70.                The default is the current foreground color setting for the
  71.                screen area that is covered by the text. See <NUBESA>. 
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. (back-color)   The color of the background block for the prompt message and
  79.                response character. If you do not provide (text-color), you
  80.                must include the ON keyword. The default is the current
  81.                background setting for the screen area that is covered by the
  82.                text. See <NUBESA>. 
  83.  
  84.                                    Notes:
  85.  
  86. The DOS batch command IF ERRORLEVEL (n) evaluates to true whenever (n) is
  87. less than or equal to the current ERRORLEVEL. To obtain the results you want
  88. from a set of IF ERRORLEVEL commands, test for the highest possible
  89. ERRORLEVEL first. See the example below. 
  90.  
  91. The BE ASK command in version 4.5 replaces the ASK command available in
  92. version 4.0. 
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103. Example:       To display a bright-red-on-yellow prompt that provides a
  104.                choice between continuing in a batch file and quitting and
  105.                that has a default value of Q if the user does not respond
  106.                within 30 seconds, enter: 
  107.  
  108.  
  109. BE ASK "Enter C to continue or Q to quit: ",CQ D=Q T=30 BRI RED ON YEL
  110. IF ERRORLEVEL 2 GOTO QUIT 
  111. :CONTINUE 
  112.      . additional commands
  113.      . 
  114.      . additional commands
  115. :QUIT 
  116. REM Last line in the batch file 
  117.  
  118. See:           <NUBE>, <NUBESA>, <NUSAMP>, <NUCOLOR>. 
  119.  
  120.