home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / batch / ebl407.zip / BATDEMO2.BAT < prev    next >
DOS Batch File  |  1992-01-15  |  5KB  |  177 lines

  1. bat * Sample of advanced user interface features in EBL-Plus.......
  2.  
  3.     *
  4.     * Define a window for text.
  5.     *   Select both color and size (x/y coordinates).
  6.     *
  7.     color( white on blue )
  8.     window( 20, 5, 70, 11)
  9.  
  10.     *
  11.     * Put some text within the window
  12.     *   Define a special character '#' to paint a color within
  13.     *   the text. This color will be used later as a "Field"
  14.     *   to allow user input
  15.     *
  16.     colorchar '#' as color(white on cyan)
  17.     type "Welcome to another EBL-Plus Demo"
  18.     type "This is a sample of an advanced user interface"
  19.     type
  20.     type "Enter your nickname and press ─┘"
  21.     type "          #      #"
  22.  
  23.     *
  24.     * Erase any association between the special character '#'
  25.     *    and a color just in case we use the character for real
  26.     *    text later.
  27.     *
  28.     colorchar
  29.  
  30.     *
  31.     * Now allow user input in the painted "field".
  32.     *    Note that the color name must match what was painted
  33.     *    above for this to work. Also, the "enter" key can return
  34.     *    to EBL in addition to any function key, ESC key, etc.
  35.     *    If "enter" wasn't used here, that key would just move
  36.     *    the cursor between fields if several were defined and
  37.     *    never return back to EBL.
  38.     *
  39.     edit( color(white on cyan ),Enter)
  40.  
  41.     *
  42.     * Now read the contents back from this first (and only) field.
  43.     *    By default, it will look for text on the screen that is
  44.     *    in the field color used within the last Edit() definition
  45.     *    above.
  46.     *
  47.     %n = field(1)
  48.  
  49.     *
  50.     * Use a few string functions to force first letter of nickname
  51.     *    as upper case, and remainder as lower case.
  52.     *
  53.     %n = upper((%n $ 1 1)) & lower((%n $ 2))
  54.  
  55.     *
  56.     * Now convert the simple menu on page 15 of the EBL manual
  57.     *    to a "point and shoot" interface. That is, the cursor
  58.     *    keys "points" a moving bar to the item to select and
  59.     *    the enter key "shoots" that item and starts the selection.
  60.     *    The previous interface only allowed numbers 1..4 to
  61.     *    be entered to select each item.
  62.     *
  63.     * Start by simplifying the color scheme since we won't use
  64.     *    windows here.
  65.     *
  66. BAT * Eva's EBL program...
  67.     color( bright white on black )
  68.  
  69.     *
  70.     * Again, we will use COLORCHAR to "paint" each field where
  71.     *    the selection bar can be placed. For variety, we will
  72.     *    use different colors than before. Also note that we have
  73.     *    chosen the @ character to paint with because other characters
  74.     *    may be in our text that we will show.
  75.     *
  76. -Menu    colorchar '@' as color(white on Blue)
  77.     Cls
  78.     Color( Black on Cyan )
  79.     window( 50, 2, 79, 8, Single)
  80.     Begtype
  81. This is a variation
  82. of an existing menu
  83. shown on page 15 of
  84. the printed EBL-Plus
  85. manual.
  86. END
  87.     *
  88.     * Now show the menu, carefully putting the @ character where
  89.     *    we want each possible selection bar to go. This is called
  90.     *    our "field color".
  91.     *
  92.     Color( Yellow on blue)
  93.     window( 1, 1, 45, 11)
  94.     Begtype           |* Show the menu
  95.       \%n's Document Menu
  96.  
  97.   @1 - Create/Edit a document          @
  98.   @2 - Print a document           @
  99.   @3 - Display directory of documents @
  100.   @4 - Exit                  @
  101.  
  102.   Use arrow keys to select an option
  103.       and press <─┘ to make choice.
  104. END
  105.     *
  106.     * Now use the SELECT() function to show moving bar. Note that the
  107.     *    "field color" here must again match what was painted on the
  108.     *    screen above.
  109.     *
  110.     * When the SELECT() function ends, there are two important
  111.     *    pieces of information available.
  112.     *      1. The function itself will have a value of the key used
  113.     *      to make the selection. In our example here, it is not
  114.     *      necessary to know this. If it was needed, it is wise to
  115.     *      hold this value in a variable like:
  116.     *        %A = SELECT( color(white on blue) )
  117.     *      2. The %R return code variable will contain the "field
  118.     *      number" where the bar is positioned. For this example,
  119.     *      this is the easiest way to make a decision of what to do.
  120.     *
  121.     SELECT( color(white on Blue) )    |* Ask for selection
  122.  
  123.     *
  124.     * Now we will hold the resulting "field number" in %0 to make the
  125.     *    remainder of this example exactly like it already is on page 15
  126.     *    of the EBL-Plus manual. (This step really isn't necessary)
  127.     *
  128.     %0 = %R
  129.  
  130.     *
  131.     * Also, we will do a LOCATE command since the SELECT() function
  132.     *    moved the cursor position to be the same as the bar position.
  133.     *    Since we have some possible questions to ask the user below,
  134.     *    we will move the cursor to a clear area away from the bar
  135.     *    for clarity.
  136.     *
  137.     Locate 1 14
  138.     Color( White )
  139.  
  140.     *
  141.     * Now the remainder of the batch file is unchanged from page 15...
  142.     *
  143.     IF %0 <> 1 GOTO -N1     |* If edit option..
  144.     READ Enter document name> %1|* which file?
  145.     Begtype
  146.  
  147. We will use EDLIN to edit your document.
  148. If you want to use this batch file extensively,
  149.    we suggest you change the name 'Edlin' within this
  150.    batch file to the name of the editor you are
  151.    familiar with.
  152. To exit EDLIN, press 'Q' and Enter.
  153. End
  154.     Edlin %1
  155.     Inkey Press any key to continue...
  156.     GOTO -Menu            |* EDIT then return
  157.  
  158. -N1
  159.     IF %0 <> 2 GOTO -N2     |* If Print option...
  160.     READ Which document to print> %1 |* Which file?
  161.     LEAVE
  162.     PRINT %1
  163.     BAT
  164.     GOTO -Menu            |* PRINT then return
  165.  
  166. -N2
  167.     IF %0 <> 3 GOTO -N3     |* If Directory...
  168.     READ Which documents to show? %1 |* Which files?
  169.     DIR  %1 /P
  170.     PAUSE
  171.     GOTO -Menu            |* DIR then return
  172.  
  173. -N3
  174.     IF %0 = 4 EXIT        |* Exit this menu?
  175.     BEEP            |* No, beep & return
  176.     GOTO -Menu
  177.