Contents of the FAKEY.DOC file

FAKEY

Keyboard Phantom Typist

Version 1.0

(C) COPYRIGHT 1986 by System Enhancement Associates; ALL RIGHTS RESERVED

FAKEY is used to fake sequences of keystrokes. It is especially useful in batch files, where it can be used to "pre-load" input for programs. It is faking it at the point where BIOS is called. It will not affect programs that bypass BIOS for their input. FAKEY can fake keyboard input for almost any program, except for certain resident utilities.

FAKEY takes one or more arguments, separated by spaces. Each argument can be any one of the following:

1) A text literal enclosed in quotes. See below.

2) A decimal number, indicating the ASCII value of a character.

3) A hexadecimal number of up to four digits, preceeded by an ampersand.

4) A mnemonic value indicating a particular keystroke.

None of these are case sensitive, except literal text in quotes. Hex digits, mnemonics, and so forth can be entered in any combination of upper and lower case.

If an argument indicates a character value, then the character value is filled out to include a scan code value. Where more than one scan code is possible (such as Backspace or Ctrl H), the more "conventional" choice is made (ie. Backspace instead of Ctrl H, top row instead of number pad, etc.)

A text literal is enclosed in quotes, and may contain special sequences. The special sequences currently defined are:

1) An uparrow followed by a character from A to Z (in this case really "at sign" to "underline"), indicating the equivalent control key.

2) An exclamation mark followed by a digit or a character from A to Z, indicating the equivalent alter key.

3) A backslash followed by another character. Defined uses are:

a) \r for a return or enter b) \t for a tab c) \b for a backspace d) \e for an escape e) \anything else, for a literal character. Thus \" is a quote, \\ is a backslash, \! is an exclamation mark, etc.

A mnemonic can be an uparrow, exclamation mark, or backslash followed by a character, in which case it means the same thing as in a text literal. The following additional mnemonics are also defined:

TOSS Causes all previous pending keystrokes to be thrown away. Does not affect the sequence being defined.

WAIT Causes a pause for seconds in the input stream. Keystrokes will not appear to be available for the duration of the wait. The maximum wait is 255 seconds.

BOOT Causes a warm system boot, as if the user had typed "Ctrl-Alt-Del".

Notes on special mnemonics:

The TOSS mnemonic takes effect at the point where FAKEY is run. It serves to discard faked keystrokes which an earlier program didn't use.

The other special mnemonics take effect at the point where they are first scanned by the operating system. This is not always when you might think. DOS (along with many applications programs) scans the keyboard buffer to see if anything is pending at many points, so things may take effect sooner than you would expect. For example, if your batch file contained:

fakey ^C myprog

then "myprog" would not be run. DOS would check the keyboard after running FAKEY and before running the next program, and see the pending control C. Your batch file would stop while DOS asks:

Terminate batch file (y/n)?

You probably don't want that. So instead, you should say:

fakey wait 1 ^C myprog

This would cause a one second delay before the control C shows up in the keyboard buffer.

If this doesn't make sense, then don't worry too much. This is all meant to address a few special cases which don't normally arise.

Example:

Here's an example of a batch file to delete all of the files in a directory, without waiting for DOS to ask for confirmation:

fakey "y\r" del %1 fakey toss

Assuming you named the file ZAPDIR.BAT, then typing ZAPDIR X would give the DOS command "del X". When DOS stops to ask "Are you sure?", it will think you pressed "y", and continue.

In this example we ended the file with "fakey toss". This is so that if DOS doesn't ask for confirmation (maybe X is a file instead of a directory), the "y" won't be left hanging around.

Hexadecimal literals:

These can be used to fake any keystroke whatsoever. Use the table following to pick out the keystroke you want. For example, a shifted keypad 5 would be:

fakey &4C35

A table entry of "--" means you can't get that combination out of BIOS.