home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
prog1
/
ebl-bat3.lzh
/
BATDEMO.BAT
< prev
next >
Wrap
DOS Batch File
|
1988-09-01
|
11KB
|
299 lines
bat /p * Loading DEMO ..... (Non-IBM systems, read NOTE within this file)
* Written by F.Canova 10/5/83 through 07/7/86
* (c) Copyright 1983, 1985, 1986 by Seaware Corp. all rights reserved.
* This batch file REQUIRES EBL Version 3 for proper execution!
**** NOTE! NOTE! NOTE! NOTE! ****
%D = 'RAM' |* <-----Change 'RAM' to 'BIOS' if PC isn't 100% IBM Compatible!
* For more information or to receive your own copy of EBL ($49) write to:
* Seaware Corp.
* P.O. Box 1656
* Delray Beach, FL 33444
*---- FEATURES OF THE LANGUAGE USED WITHIN THIS DEMO ARE: ----------------
* Standard DOS commands can be intermixed freely with BAT commands.
* Up to 127 chars are allowed for labels, contents of vars, and literals
* 10 variables are provided to be passed to/from DOS. They're %0 to %9.
* 15 variables are provided for user use only. They're %A to %O.
* The variable %R is a return code that any routine can set at [0:04FE]
* Note that 'BEGTYPE' & 'BEGSTACK' do not do variable substitution.
* BEGTYPE command can have screen attributes via a '\hex' format.
* BEGSTACK command can have timing attributes via a '\hex' format.
* Spaces are needed to delimit operators.
* Non-spaces will concatenate variables and literals.
* STATEOF sets return code based on state of files existence.
color high-intensity on blue
begtype
┌─────────────────────────────────────────────────────────────────────────┐
│ Welcome to Extended Batch Language Version 3 Demonstration ! │
└─────────────────────────────────────────────────────────────────────────┘\0f
What is your first name? ;
end
read %8
%7 = 27
%L =
%0 = ( " " & %8 & "'s Extended Batch Sampler Menu " ) $ 1 48
goto -top
* number guessing demo *
-i.can.count %6 = 5
cls type "I am thinking of a two digit number, can you guess it?"
-c.loop read %5
if %5 = %7 skip 7
%6 = %6 - 1
if %6 <> 0 skip 2
type "Boo hisss! The number was" %7!
skip 4
if %5 > %7 type "Try a little lower. You only get" %6 "more tries."
if %5 < %7 type "Try a higher number. You get" %6 "more tries."
goto -c.loop
type "Great! I was afraid you weren't going to get it!"
begtype
\1f═════════════════════════════════════════════════════════════════════════════\07
A BAT program can create loops and count events. With this you can
sequence through file numbers, or create loops to do retries in case of
errors. EBL programs can even do arithmetic (up to 19 digits) and string
manipulation (up to 127 characters mixed case). In addition, an external
function BATMATH is provided to registered users when floating point math
is needed.
\1f═════════════════════════════════════════════════════════════════════════════\07
(press any key to continue)
end
inkey
-top
IF %D = 'RAM' then RAM
ELSE BIOS
cls begtype
\1f═════════════════════════════════════════════════\07 \17┌─────────────────────────┐\07
\1f\%0 \07 \17│ User supported software │\07
\1f═════════════════════════════════════════════════\07 \17│ by │\07
\17│ │\07
\17│ Seaware Corp. │\07
\70 C \0f - I can Count \17│ P.O. Box 1656 │\07
\17│ Delray Beach, FL 33444 │\07
\70 D \0f - Directory of available programs \17│ 407/392-2046 │\07
\17│ │\07
\70 F \0f - Testing for files \17│ Order your registered │\07
\17│ copy for $49 from us │\07
\70 K \0f - Keyboard stack (the invisible fingers) \17│ directly or our order │\07
\17│ line at 800/634-8188 │\07
\70 S \0f - Display Screen and String operations \17│ │\07
\17│ │\07
\70 X \0f - Exit \17│ Please copy and share │\07
\17│ BAT.COM, BATFUNC1.COM, │\07
\17│ BATDOC.BAT, BATDEMO.BAT │\07
Select an option. \17│ for non-commercial uses │\07
\17│ only. │\07
\17└─────────────────────────┘\07
END
-entry read %9
%7 = %7 + 3
if %9 <> 'd' goto -not.d
type "Enter file.spec for files you would like to see, or press ENTER for all."
read %1
if .%1 = '.' then %1 = "*.*"
-dirques type "Would you like a (S)tandard or (W)ide directory?"
inkey %2 | if ( %2 # ) = 1 type %2
* Notice you can chain together IFs, like . . .
if %2 <> 's' then if %2 <> 'w' goto -dirques
if %2 = 'w' then %3 = '/w'
else %3 =
cls
leave |* leave EBL but continue batch file with DOS so can see execution...
REM (notice that two parms are passed to DOS here. %%1 and %%3)
dir %1 %3
bat * Returning to Extended Batch demo *
bat /p * This switch allows pgms to be written without 'bat' prefix.
begtype
\1f═════════════════════════════════════════════════════════════════════════════\07
This directory was created by using a DOS command within this batch file. Any
DOS command can be mixed freely within lines of the BAT program. By passing
parameters to/from DOS, you can have complete control of how a program
operates. User programs may also set a return code in order to control the
execution of the BAT batch file program.
\1f═════════════════════════════════════════════════════════════════════════════\07
Press any key to continue. . .
end
inkey
goto -top
-not.d if %9 <> x skip 3
type "So long" %8....
type "P.S. For quickie help, just enter 'BAT' from DOS!"
exit
if %9 = 'c' goto -i.can.count
if %9 <> 'f' goto -not.f
-is.f type "Enter a file name for me to search for."
read %9
if /%9 = '/ ' then goto -is.f
type "Scanning for file:" %9 . . .
stateof %9 |* this will set the return code up (%R)
if %r <> 0 skip 2
type "The file does exist - exactly as typed."
skip 7
if %r <> 1 skip 2
type "The file does not exist on any drive."
skip 5
if %r <> 9 skip 2
type "The file name given is invalid."
skip 2
type "The file does exist - but was found on the" %r "drive."
type "To properly find this file, the complete filename would be" %9
begtype
\1f═════════════════════════════════════════════════════════════════════════════\07
File searching is done by a command called STATEOF.
If the file was there, we could direct a program to use it, even if it wasn't
on the specific diskette drive that the operator was expecting.
If the file was not there, we could have printed out an error message to the
operator, or we could have run an alternate program in order to create the
missing file.
Extended Batch Language Version 3 can now also read and write files. This is
useful for making configuration files, setting up printers, etc.
\1f═════════════════════════════════════════════════════════════════════════════\07
Press any key to continue . . .
end
inkey
goto -top
-not.f if %9 <> k goto -not.k
cls begtype
╔═════════════════════════════════════════════════════════════════════════════╗
║ ║
║ The keyboard stack can answer questions to programs automatically. ║
║ For example, this DOS command is being answered by the keyboard stack.║
║ ║
╚═════════════════════════════════════════════════════════════════════════════╝
end
begstack
This text is actually being typed for you from the keyboard stack.
All keys, including control keys and function keys can come from this stack.
Keystrokes can \ff\10even \ff\10have \ff\10delayed \ff\10typing.
\1a
end
stack.on |* This makes sure copy can see our stack contents.
rem ... Below is the DOS command that will read the keyboard stack.
copy con: nul:
BAT *returning from DOS command*
bat /p * This switch allows pgms to be written without 'bat' prefix.
begtype
(press any key to continue)
end
inkey
goto -top
-not.k if %9 <> 's' goto -not.s
cls begtype
╔═════════════════════════════════════════════════════════════════════════════╗
║ ║
║ All sorts of screen attributes can be printed on the screen. ║
║ ║
║ On monochrome display you see: On color display you see: ║
╚═════════════════════════════════════════════════════════════════════════════╝
\04Normal Red on Black \07
\0fHigh Intensity High Intensity\07
\21Underlined Blue on Green \07
\85Flashing Normal Flashing Magenta on Black\07
And \0fmany\07 other combinations!
END
ansi
begtype
\1b[33;44m Users of ANSI.SYS can also control colors & the display.\1b[0m
(press any key to continue)
end
inkey
IF %D = 'RAM' THEN RAM
ELSE BIOS
cls
-rd.name1
if .%8 <> '.' skip 2
read I didn't catch your first name, what was it? %8
goto -rd.name1
type "I know that your first name is" %8
-rd.name2
if .%L <> '.' skip 2
read I didn't catch your last name, what was it? %L
goto -rd.name2
CLS BEGTYPE
I am using your name as two strings to work with.
Comparisons can be made . . .
END
if %8 = %L type "The strings are equal."
if %8 <> %L type "The strings are not equal."
* notice a '.' will make sure that null entries can be found
type
type "Strings contents can be manipulated . . ."
type "CONCATENATION.. They can be combined to form" %8%L
type "CONCATENATION.. or to form" %L%8.
/U | %I = %8 $ 1 1
%I = %I.%L $ 1 3 | /U-
%H = %8 #
type "SUBSTRINGS..... Your initials would be" %I.
type "LENGTHS........ Your first name has" %H "letters."
begtype
\1f═════════════════════════════════════════════════════════════════════════════\07
Strings can be up to 127 characters and may be passed back and forth to DOS.
Flexible String operations and comparisons can be done as well. There are 10
variables for strings which may operate with DOS, and 15 which can be used
even between executing BAT programs. There are another 5 variables which
have predefined (fixed) contents to give status, etc. BATXV is an external
function provided to registered users that can contain Extended Variables.
It allows almost unlimited variable space. It also allows flexible variable
names, indexing, and array capabilities.
\1f═════════════════════════════════════════════════════════════════════════════\07
(Press any key to continue)
end
inkey
goto -top
-not.s BEGTYPE
You did not select a valid option.
Press \0FC, D, F, S or X\07.
END
goto -entry
bat -on.error-
bat begtype
Unexpected error \%S%R in line \%S%L !
This batch file was error free when it was distributed
by Seaware. An error indicates that it was most likely
modified by someone improperly. To get an updated demo
diskette send $10 to Seaware directly or call 800/634-8188.
Seaware Corp.
Post Office Box 1656
Delray Beach, FL 33444
end