home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
sysutils
/
errorlev
/
getkey
/
getkey.doc
next >
Wrap
Text File
|
1988-11-09
|
2KB
|
55 lines
* GETKEY.EXE *
==============================================================================
1) Getkey2.exe .......... Duel mode key capture
2) Lines.exe .......... Duel mode screen re-sizer
3) Input.bat .......... Batch file for command.com (DOS)
4) Input.cmd .......... Batch file for cmd.exe (OS/2)
Getkey2.exe is a short program for OS/2 or DOS that gets an ASCII character
from the keyboard and then passes it to cmd.exe or command.com as a termination
code which can be read by the 'if errorlevel' statement in a batch file under
OS/2 or DOS.
This file runs under OS/2 or DOS. To minimize the files size, it is not
bound: the DOS code is included in the stub loader and it reads the keyboard
if the program is loaded under DOS (normally the stub loader displays the
message "This program cannot run under DOS", but it can contain different code
code, as it does here).
Lines.exe is a program that toggles the VGA screen between 25 and 50
lines; like getkey2.exe, it runs under both OS/2 and DOS.
Input.bat is a batch file that demos the use of getkey2.exe, and
how branching can be implimented in a batch file, and input.cmd is the
OS/2 version of the file. They use the same programs and statements,
only the extension is different, allowing the user to have the same util-
ities w/ two operating systems.
This allows user input into batch files, with branching via 'goto' state-
ments as required.
The important thing to remember is that the errorlevel statement returns
'true' if the input keyboard value in decimal ASCII is equal to or greater
than the variable value to be tested. It returns 'false ' if the value is
less than the variable (in decimal ASCII). In the examples used in this file
the values tested are 121 for lower case 'y', and 110 for lower case 'n'.
Obviously, creative branching can be set up by judicious use of the
'if errorlevel ... ' and 'if not errorlevel ...' statements ('not' reverses
the conditions under which 'true' is returned) and the 'goto' statement.
Just remember that the actual numbers tested are decimal ASCII.
=Harve=
Compuserve 72261,347
=Harve Schiffman=
Compuserve 72261,347