home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / ebl.zip / BATDEMO.BAT < prev    next >
DOS Batch File  |  1988-09-01  |  11KB  |  299 lines

  1. bat /p * Loading DEMO ..... (Non-IBM systems, read NOTE within this file)
  2.  
  3. *           Written by F.Canova 10/5/83 through 07/7/86
  4. *   (c) Copyright 1983, 1985, 1986 by Seaware Corp. all rights reserved.
  5. *    This batch file REQUIRES EBL Version 3 for proper execution!
  6.  
  7.          **** NOTE! NOTE! NOTE! NOTE! ****
  8. %D = 'RAM'    |* <-----Change 'RAM' to 'BIOS' if PC isn't 100% IBM Compatible!
  9.  
  10. * For more information or to receive your own copy of EBL ($49) write to:
  11. *             Seaware Corp.
  12. *             P.O. Box 1656
  13. *             Delray Beach, FL 33444
  14.  
  15. *---- FEATURES OF THE LANGUAGE USED WITHIN THIS DEMO ARE: ----------------
  16. * Standard DOS commands can be intermixed freely with BAT commands.
  17. * Up to 127 chars are allowed for labels, contents of vars, and literals
  18. * 10 variables are provided to be passed to/from DOS. They're %0 to %9.
  19. * 15 variables are provided for user use only. They're %A to %O.
  20. * The variable %R is a return code that any routine can set at [0:04FE]
  21. * Note that 'BEGTYPE' & 'BEGSTACK' do not do variable substitution.
  22. * BEGTYPE  command can have screen attributes via a '\hex' format.
  23. * BEGSTACK command can have timing attributes via a '\hex' format.
  24. * Spaces are needed to delimit operators.
  25. * Non-spaces will concatenate variables and literals.
  26. * STATEOF sets return code based on state of files existence.
  27.  
  28. color high-intensity on blue
  29. begtype
  30.  
  31. ┌─────────────────────────────────────────────────────────────────────────┐
  32. │    Welcome to Extended Batch Language Version 3 Demonstration !      │
  33. └─────────────────────────────────────────────────────────────────────────┘\0f
  34.  
  35.     What is your first name? ;
  36. end
  37.        read %8
  38.        %7 = 27
  39.        %L =
  40.        %0 = ( " " & %8 & "'s Extended Batch Sampler Menu                     " ) $ 1 48
  41.        goto -top
  42.  
  43.     * number guessing demo *
  44.  
  45. -i.can.count %6 = 5
  46.        cls type "I am thinking of a two digit number, can you guess it?"
  47. -c.loop read %5
  48.        if %5 = %7 skip 7
  49.        %6 = %6 - 1
  50.        if %6 <> 0 skip 2
  51.        type "Boo hisss! The number was" %7!
  52.        skip 4
  53.        if %5 > %7 type "Try a little lower. You only get" %6 "more tries."
  54.        if %5 < %7 type "Try a higher number. You get" %6 "more tries."
  55.        goto -c.loop
  56.        type "Great! I was afraid you weren't going to get it!"
  57.        begtype
  58.  
  59. \1f═════════════════════════════════════════════════════════════════════════════\07
  60.   A BAT program can create loops and count events.  With this you can
  61.   sequence through file numbers, or create loops to do retries in case of
  62.   errors.  EBL programs can even do arithmetic (up to 19 digits) and string
  63.   manipulation (up to 127 characters mixed case).  In addition, an external
  64.   function BATMATH is provided to registered users when floating point math
  65.   is needed.
  66. \1f═════════════════════════════════════════════════════════════════════════════\07
  67.  
  68. (press any key to continue)
  69. end
  70. inkey
  71.  
  72. -top
  73.     IF %D = 'RAM' then RAM
  74.     ELSE BIOS
  75.     cls begtype
  76. \1f═════════════════════════════════════════════════\07  \17┌─────────────────────────┐\07
  77. \1f\%0 \07  \17│ User supported software │\07
  78. \1f═════════════════════════════════════════════════\07  \17│           by          │\07
  79.                            \17│             │\07
  80.                            \17│ Seaware Corp.        │\07
  81.  \70 C \0f - I can Count                 \17│ P.O. Box 1656          │\07
  82.                            \17│ Delray Beach, FL 33444    │\07
  83.  \70 D \0f - Directory of available programs         \17│ 407/392-2046          │\07
  84.                            \17│             │\07
  85.  \70 F \0f - Testing for files                 \17│ Order your registered   │\07
  86.                            \17│ copy for $49 from us    │\07
  87.  \70 K \0f - Keyboard stack (the invisible fingers)     \17│ directly or our order   │\07
  88.                            \17│ line at 800/634-8188    │\07
  89.  \70 S \0f - Display Screen and String operations     \17│                  │\07
  90.                            \17│             │\07
  91.  \70 X \0f - Exit                     \17│ Please copy and share   │\07
  92.                            \17│ BAT.COM, BATFUNC1.COM,    │\07
  93.                            \17│ BATDOC.BAT, BATDEMO.BAT │\07
  94. Select an option.                   \17│ for non-commercial uses │\07
  95.                            \17│ only.            │\07
  96.                            \17└─────────────────────────┘\07
  97. END
  98. -entry read %9
  99.     %7 = %7 + 3
  100.     if %9 <> 'd' goto -not.d
  101.     type "Enter file.spec for files you would like to see, or press ENTER for all."
  102.     read %1
  103.     if .%1 = '.' then %1 = "*.*"
  104.     -dirques type "Would you like a (S)tandard or (W)ide directory?"
  105.     inkey %2 | if ( %2 # ) = 1 type %2
  106.     * Notice you can chain together IFs, like . . .
  107.     if %2 <> 's' then if %2 <> 'w' goto -dirques
  108.     if %2 = 'w' then %3 = '/w'
  109.        else %3 =
  110.     cls
  111.     leave |* leave EBL but continue batch file with DOS so can see execution...
  112.     REM  (notice that two parms are passed to DOS here. %%1 and %%3)
  113.     dir %1 %3
  114.     bat * Returning to Extended Batch demo *
  115.     bat /p  * This switch allows pgms to be written without 'bat' prefix.
  116.     begtype
  117.  
  118. \1f═════════════════════════════════════════════════════════════════════════════\07
  119. This directory was created by using a DOS command within this batch file. Any
  120. DOS command can be mixed freely within lines of the BAT program. By passing
  121. parameters to/from DOS, you can have complete control of how a program
  122. operates. User programs may also set a return code in order to control the
  123. execution of the BAT batch file program.
  124. \1f═════════════════════════════════════════════════════════════════════════════\07
  125.  
  126.     Press any key to continue. . .
  127. end
  128.     inkey
  129.     goto -top
  130.  
  131. -not.d if %9 <> x skip 3
  132.     type "So long" %8....
  133.     type "P.S. For quickie help, just enter 'BAT' from DOS!"
  134.     exit
  135.  
  136. if %9 = 'c' goto -i.can.count
  137.  
  138. if %9 <> 'f' goto -not.f
  139. -is.f    type "Enter a file name for me to search for."
  140.     read %9
  141.     if /%9 = '/ ' then goto -is.f
  142.     type "Scanning for file:" %9 . . .
  143.     stateof %9 |* this will set the return code up (%R)
  144.     if %r <> 0 skip 2
  145.        type "The file does exist - exactly as typed."
  146.        skip 7
  147.     if %r <> 1 skip 2
  148.        type "The file does not exist on any drive."
  149.        skip 5
  150.     if %r <> 9 skip 2
  151.        type "The file name given is invalid."
  152.        skip 2
  153.     type "The file does exist - but was found on the" %r "drive."
  154.     type "To properly find this file, the complete filename would be" %9
  155.     begtype
  156.  
  157. \1f═════════════════════════════════════════════════════════════════════════════\07
  158.        File searching is done by a command called STATEOF.
  159.  
  160. If the file was there, we could direct a program to use it, even if it wasn't
  161. on the specific diskette drive that the operator was expecting.
  162.  
  163. If the file was not there, we could have printed out an error message to the
  164. operator, or we could have run an alternate program in order to create the
  165. missing file.
  166.  
  167. Extended Batch Language Version 3 can now also read and write files. This is
  168. useful for making configuration files, setting up printers, etc.
  169. \1f═════════════════════════════════════════════════════════════════════════════\07
  170.  
  171. Press any key to continue . . .
  172. end
  173.     inkey
  174.     goto -top
  175.  
  176. -not.f if %9 <> k goto -not.k
  177.     cls begtype
  178. ╔═════════════════════════════════════════════════════════════════════════════╗
  179. ║                                          ║
  180. ║    The keyboard stack can answer questions to programs automatically.    ║
  181. ║    For example, this DOS command is being answered by the keyboard stack.║
  182. ║                                          ║
  183. ╚═════════════════════════════════════════════════════════════════════════════╝
  184. end
  185.     begstack
  186. This text is actually being typed for you from the keyboard stack.
  187. All keys, including control keys and function keys can come from this stack.
  188. Keystrokes can \ff\10even \ff\10have \ff\10delayed \ff\10typing.
  189. \1a
  190. end
  191.     stack.on    |* This makes sure copy can see our stack contents.
  192. rem ... Below is the DOS command that will read the keyboard stack.
  193. copy con: nul:
  194. BAT *returning from DOS command*
  195. bat /p    * This switch allows pgms to be written without 'bat' prefix.
  196.     begtype
  197.  
  198. (press any key to continue)
  199. end
  200.     inkey
  201.     goto -top
  202.  
  203. -not.k if %9 <> 's' goto -not.s
  204.     cls begtype
  205. ╔═════════════════════════════════════════════════════════════════════════════╗
  206. ║                                          ║
  207. ║    All sorts of screen attributes can be printed on the screen.          ║
  208. ║                                          ║
  209. ║   On monochrome display you see:          On color display you see:       ║
  210. ╚═════════════════════════════════════════════════════════════════════════════╝
  211.  
  212.     \04Normal                Red on Black  \07
  213.     \0fHigh Intensity            High Intensity\07
  214.     \21Underlined                Blue on Green \07
  215.     \85Flashing Normal            Flashing Magenta on Black\07
  216.  
  217.         And \0fmany\07 other combinations!
  218.  
  219. END
  220. ansi
  221. begtype
  222. \1b[33;44m Users of ANSI.SYS can also control colors & the display.\1b[0m
  223.  
  224.  
  225. (press any key to continue)
  226. end
  227.     inkey
  228.     IF %D = 'RAM' THEN RAM
  229.     ELSE BIOS
  230.     cls
  231. -rd.name1
  232.     if .%8 <> '.' skip 2
  233.        read I didn't catch your first name, what was it? %8
  234.        goto -rd.name1
  235.     type "I know that your first name is" %8
  236. -rd.name2
  237.     if .%L <> '.' skip 2
  238.        read I didn't catch your last name, what was it? %L
  239.        goto -rd.name2
  240.     CLS BEGTYPE
  241.  
  242. I am using your name as two strings to work with.
  243.  
  244. Comparisons can be made . . .
  245. END
  246.     if %8 = %L type "The strings are equal."
  247.     if %8 <> %L type "The strings are not equal."
  248.     * notice a '.' will make sure that null entries can be found
  249.     type
  250.     type "Strings contents can be manipulated . . ."
  251.     type "CONCATENATION.. They can be combined to form" %8%L
  252.     type "CONCATENATION.. or to form" %L%8.
  253.     /U | %I = %8 $ 1 1
  254.     %I = %I.%L $ 1 3   | /U-
  255.     %H = %8 #
  256.     type "SUBSTRINGS..... Your initials would be" %I.
  257.     type "LENGTHS........ Your first name has" %H "letters."
  258.     begtype
  259.  
  260. \1f═════════════════════════════════════════════════════════════════════════════\07
  261.   Strings can be up to 127 characters and may be passed back and forth to DOS.
  262.   Flexible String operations and comparisons can be done as well.  There are 10
  263.   variables for strings which may operate with DOS, and 15 which can be used
  264.   even between executing BAT programs.    There are another 5 variables which
  265.   have predefined (fixed) contents to give status, etc.  BATXV is an external
  266.   function provided to registered users that can contain Extended Variables.
  267.   It allows almost unlimited variable space.  It also allows flexible variable
  268.   names, indexing, and array capabilities.
  269. \1f═════════════════════════════════════════════════════════════════════════════\07
  270.  
  271. (Press any key to continue)
  272. end
  273.     inkey
  274.     goto -top
  275.  
  276. -not.s BEGTYPE
  277.  
  278. You did not select a valid option.
  279. Press \0FC, D, F, S or X\07.
  280. END
  281.     goto -entry
  282.  
  283. bat -on.error-
  284. bat begtype
  285.  
  286.      Unexpected error \%S%R in line \%S%L !
  287.  
  288.      This batch file was error free when it was distributed
  289.      by Seaware. An error indicates that it was most likely
  290.      modified by someone improperly. To get an updated demo
  291.      diskette send $10 to Seaware directly or call 800/634-8188.
  292.  
  293.  
  294.  
  295.             Seaware Corp.
  296.              Post Office Box 1656
  297.             Delray Beach, FL 33444
  298. end
  299.