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: Standard ASCII mnemonics: NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US SP DEL Cursor movement keypad mnemonics: UP DOWN LEFT RITE HOME END PGUP PGDN Function key mnemonics: Fn for normal Sn for shifted Cn for control An for alter Where "n" is a number from 1 to 10. Ie. A10 means Alt F10. Special mnemonics: 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. BIOS keystroke codes, hexadecimal Key Normal Shift Control Alter Esc 011B 011B 011B -- 1! 0231 '1' 0221 '!' -- 7800 2@ 0332 '2' 0340 '@' 0300 7900 3# 0433 '3' 0423 '#' -- 7A00 4$ 0534 '4' 0524 '$' -- 7B00 5% 0635 '5' 0625 '%' -- 7C00 6^ 0736 '6' 075E '^' 071E 7D00 7& 0837 '7' 0826 '&' -- 7E00 8* 0938 '8' 092A '*' -- 7F00 9( 0A39 '9' 0A28 '(' -- 8000 0) 0B30 '0' 0B29 ')' -- 8100 -_ 0C2D '-' 0C5F '_' 0C1F 8200 =+ 0D3D '=' 0D2B '+' -- 8300 BkSpc 0E08 0E08 0E7F -- tab 0F09 0F00 -- -- q 1071 'q' 1051 'Q' 1011 1000 w 1177 'w' 1157 'W' 1117 1100 e 1265 'e' 1245 'E' 1205 1200 r 1372 'r' 1352 'R' 1312 1300 t 1474 't' 1454 'T' 1414 1400 y 1579 'y' 1559 'Y' 1519 1500 u 1675 'u' 1655 'U' 1615 1600 i 1769 'i' 1749 'I' 1709 1700 o 186F 'o' 184F 'O' 180F 1800 p 1970 'p' 1950 'P' 1910 1900 [{ 1A5B '[' 1A7B '{' 1A1B -- ]} 1B5D ']' 1B7D '}' 1B1D -- enter 1C0D 1C0D 1C0A -- Ctrl -- -- -- -- a 1E61 'a' 1E41 'A' 1E01 1E00 s 1F73 's' 1F53 'S' 1F13 1F00 d 2064 'd' 2044 'D' 2004 2000 f 2166 'f' 2146 'F' 2106 2100 g 2267 'g' 2247 'G' 2207 2200 h 2368 'h' 2348 'H' 2308 2300 j 246A 'j' 244A 'J' 240A 2400 k 256B 'k' 254B 'K' 250B 2500 l 266C 'l' 264C 'L' 260C 2600 ;: 273B ';' 273A ':' -- -- '" 2827 ''' 2822 '"' -- -- `~ 2960 '`' 297E '~' -- -- l shift -- -- -- -- \| 2B5C '\' 2B7C '|' 2B1C -- z 2C7A 'z' 2C5A 'Z' 2C1A 2C00 x 2D78 'x' 2D58 'X' 2D18 2D00 c 2E63 'c' 2E43 'C' 2E03 2E00 v 2F76 'v' 2F56 'V' 2F16 2F00 b 3062 'b' 3042 'B' 3002 3000 n 316E 'n' 314E 'N' 310E 3100 m 326D 'm' 324D 'M' 320D 3200 ,< 332C ',' 333C '<' -- -- .> 342E '.' 343E '>' -- -- /? 352F '/' 353F '?' -- -- r shift -- -- -- -- PrtSc 372A '*' -- 7200 -- Alt -- -- -- -- spacebar 3920 ' ' 3920 ' ' 3920 ' ' 3920 ' ' CapsLock -- -- -- -- F1 3B00 5400 5E00 6800 F2 3C00 5500 5F00 6900 F3 3D00 5600 6000 6A00 F4 3E00 5700 6100 6B00 F5 3F00 5800 6200 6C00 F6 4000 5900 6300 6D00 F7 4100 5A00 6400 6E00 F8 4200 5B00 6500 6F00 F9 4300 5C00 6600 7000 F10 4400 5D00 6700 7100 NumLock -- -- -- -- Scroll -- -- -- -- 7 Home 4700 4737 '7' 7700 -- 8 up 4800 4838 '8' -- -- 9 PgUp 4900 4939 '9' 8400 -- grey - 4A2D '-' 4A2D '-' -- -- 4 left 4B00 4B34 '4' 7300 -- 5 -- 4C35 '5' -- -- 6 right 4D00 4D36 '6' 7400 -- grey + 4E2B '+' 4E2B '+' -- -- 1 End 4F00 4F31 '1' 7500 -- 2 down 5000 5032 '2' -- -- 3 PgDn 5100 5133 '3' 7600 -- Ins 5200 5230 '0' -- -- Del 5300 532E '.' -- -- ------------------------------------------------------------ This disk copy provided as a service of The Public (Software) Library the software library of The Houston Area League of PC Users For a copy of the latest monthly software library newsletter and a list of the 600+ disks in the library, call or write The Public (Software) Library P.O.Box 61565 Houston, TX 77208 (713) 721-6104 Newsletter subscriptions are available for $12 a year.