home *** CD-ROM | disk | FTP | other *** search
- Text File _funky.rem
-
-
-
-
- FUNKY.COM
-
- The purpose of the FUNKY utility is to allow the user of a Batch File to answer
- a prompting message or comment with any key that generates an "extended" key
- code. Examples of such keys include the Function Keys F1 - F10 (also, the
- shifted, Ctrl, and Alt F1 - F10), the Cursor Control ("arrow") keys, and many
- other Alt and Ctrl key combinations. A complete list is available later in
- this tutorial. When the user answers the prompt with such a key, the FUNKY
- utility then sets the system "errorlevel" parameter so that a subsequent IF
- subcommand in the Batch File can branch accordingly. FUNKY will optionally
- execute some display formatting commands before it displays a prompt string.
-
-
- The format of the FUNKY command line is shown below, with the usual convention
- that items in brackets [ ] are optional.
-
- FUNKY [ / [ c1 [ c2 ... ] ] / ] [ string ]
-
- where c1, c2, etc are optional formatting commands enclosed in slashes.
- These commands are executed in the order they are encountered, before the
- string is displayed. The one-letter commands that are currently supported
- include the following:
-
-
- B or b Beep the console
-
- L or l Skip one line
-
- D or d Display a "delimiting" border across the screen.
-
-
- After the "slash" commands are executed, the string is displayed. If no
- slashes precede the string, the leading blanks and tabs are discarded. If
- slashes were present, then all characters after the second slash are
- displayed.
-
- The only constraint on the string's characters is that "<", "|", and ">" must
- not be used in the string.
-
- Following the string, a reverse video "box" is displayed. When the user
- responds with a keystroke, the box "un-reverses". Usually, extended keycodes
- do not display on the screen.
-
- FUNKY then returns to the Batch File with the errorlevel parameter set to the
- extended code of the key that was struck. Representative examples of extended
- keys are as follows:
-
- 59 - 68 Function keys F1 - F10 (base case)
-
- 71 Home
-
- 72 Cursor up arrow
-
- 73 Pg Up
-
- 75 Cursor left arrow
-
- 77 Cursor right arrow
-
- 79 End
-
- 80 Cursor down arrow
-
- 81 Pg Dn
-
-
- If a key without an extended code (most alphanumeric and punctuation keys) is
- typed, then FUNKY returns the following errorlevel codes:
-
-
- 0 If the key is ESC
-
- 255 For any other "non-extended" key
-
-
- Let's return to Batch File execution and show a simple example of FUNKY and how
- to test the errorlevel code with subsequent IF subcommands. We'll first
- display the command lines in these comments, and then we will return to the
- Batch File and execute the same command lines.
-
- Here are the command lines:
-
- echo F1 Batch Files are useful and increase productivity.
- echo F2 Batch Files are unfathomable and a general pain.
- echo F3 Batch Files are @#$%#$@% !!!
- funky/llb/ Please select one of the above :
- if not errorlevel 1 goto esc
- if not errorlevel 59 goto below
- if errorlevel 255 goto non_ext
- if errorlevel 62 goto higher
- if errorlevel 61 goto f3_typed
- if errorlevel 60 goto f2_typed
- echo You pressed F1. I find them useful, too!
- goto continue
- :esc
- echo You struck ESC. Are you trying to sneak out?
- goto continue
- :below
- echo You pressed a key with an extended code below 59.
- goto continue
- :non_ext
- echo You pressed a non-extended key.
- goto continue
- :higher
- echo You pressed a key with an extended code above 61.
- goto continue
- :f3_typed
- echo Now, Now. It's not THAT bad.
- goto continue
- :f2_typed
- echo Well, I felt that way until I wrote these utilities ...
- :continue
-
-
- You can't see the whole sequence now ( printing a listing of these tutorial
- files for a guide helps ), but you probably have the idea. Let's go back to
- Batch file execution and execute the command lines above. Here goes ...