home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best Objectech Shareware Selections
/
UNTITLED.iso
/
boss
/
refe
/
soft
/
004
/
chapt5.
< prev
next >
Wrap
Text File
|
1992-03-03
|
9KB
|
259 lines
CHAPTER 5
KEYBOARD MACROS
Using the F Function Keys (F1 to F10)
▀ Keyboard Macros
▀ Redefining Keys
▀ Writing Scan Codes
▀ One Keystroke Commands
MACROS ARE DESIGNED TO SAVE KEYSTROKES.
You can put one or several strings of command
together and assign them as one group to one of
the keys. When that key is struck it will carry
out (execute) all the commands you assigned to that key.
The F function keys (F1 to F10) are the keys most used
for storing the Macros (Commands). The ten F function keys
are also used in combination with the Shift key, Control key,
and the Alt key. This gives 40 possible Macros that you can
make.
The F keys (F1 to F10) when used by themselves make
a single keystroke Macro. This means that if you assign the F1
key the command to Format a disk, then when you strike the
F1 key it will Format a disk. It does not require that you press
the Enter key. Most Macros include the automatic carriage
return which is the same as pressing the Enter key.
When you combine an F key with the Shift key you make a
two-keystroke Macro. To use a Shift-F key Macro you press
and hold down the Shift key and then strike the F key.
REDEFINING KEYS
Redefining keys means changing the content of the key
to represent something different from the function assigned
to that key: For example, you can change the F1 function key
(top row) to mean Copy, Format, or anything you like. The
name of the key will still be F1, but you have changed the
contents of F1 so that when you strike the F1 key it may Copy
a file, Format a disk, or something else.
Redefining keys is a good way of putting commands in
keys that you don't use and make them a super Speed key that
uses only one keystroke. Most Macros use the F keys first, then
a combination then the Alt-F keys and Shift-F keys.
Since these F keys will be used only for a particular
command you can make the key have an Automatic Return.
This means that when you strike a particular F key it will
automatically trigger the return key. All you need to do is
strike one key and the command goes into action. This type
of key is called a single keystroke Macro. The F-key
combinations (SHIFT-F1) are two keystroke Macros.
-16-
Macros are easily cancelled and can be redefined and
made into another Macro. There are temporary Macros that
you can create as you need them, and there are the permanent
Macros that are stored on your disk.
MACROS ARE FAST AND DO THE JOB
Macros save keystrokes.
Macros are used in almost all word processing programs,
spreadsheets, database, and most other programs.
A NOTE ABOUT F KEYS
If you use the F6 key as a Macro you can make an F6 by
using Ctrl + Z keys. This is the same as striking the F6 key.
This is important when writing Batch files where the F6 key
is used to end a line of text.
EVERY KEY ON THE KEYBOARD HAS A CODE NUMBER
By using the number (called a Scan Code) corresponding
to the key you can change the content (assignment) of that
key. The keyboard Scan Code for the F1 key is 0;59, F2 is 0;60,
F3 is 0;61 and so forth to F10 which is 0;68.
Table 1 is a list of redefinition code numbers (scan codes)
to be used in redefining the F keys and combinations of F keys.
TABLE OF KEY CODES
F-Key Code SHIFT-F CODE CTRL-F CODE ALT-F CODE
F1 0;59 SH-F1 0;84 Ctrl-F1 0;94 Alt-F1 0;104
F2 0;60 SH-F2 0;85 Ctrl-F2 0;95 Alt-F2 0;105
F3 0;61 SH-F3 0;86 Ctrl-F3 0;96 Alt-F3 0;106
F4 0;62 SH-F4 0;87 Ctrl-F4 0;97 Alt-F4 0;107
F5 0;63 SH-F5 0;88 Ctrl-F5 0;98 Alt-F5 0;108
F6 0;64 SH-F6 0;89 Ctrl-F6 0;99 Alt-F6 0;109
F7 0;65 SH-F7 0;90 Ctrl-F7 0;100 Alt-F7 0;110
F8 0;66 SH-F8 0;91 Ctrl-F8 0;101 Alt-F8 0;111
F9 0;67 SH-F9 0;92 Ctrl-F9 0;102 Alt-F9 0;112
F10 0;68 SH-F10 0;93 Ctrl-F10 0;103 Alt-F10 0;113
F11 0;133 Home Key 0;71 Down Arrow 0;80
F12 0;134 Up Arrow 0;7
WRITING SCAN CODES
All code numbers are always separated by a semicolon.
All codes must have this Prompt Escape sign:
Prompt $e[ .....
There are four items to remember in using the Escape
sign, they are:
▀ Prompt $e[
▀ semicolon (;)
▀ The small "p" (tells DOS that it is end of file)
▀ The number 13 is the code for carriage return
(Same as pressing the Enter key.)
-17-
Remember these four items and you'll have no problems with
Macros or Key definition (Changes).
HERE'S AN EXAMPLE
Prompt $e[ 0;59; "DIR"; 13 p $p$g
Putting them together it looks like this:
Prompt $e[0;59;"DIR";13p $p$g
The quotation marks tell the computer that the item in quotes
is not an ASCII character.
▀ The $p$g gives you a prompt A:\>, and saves you
from having to type the word prompt.
▀ The small "p" tells the computer that it is the end of
the string of numbers and letters.
▀ The small "p" must always be the last item when you
are using key functions.
▀ The character 13 is the code for carriage return
(same as pressing the Enter key).
HOW TO USE THE CODE NUMBERS
Suppose you want to make the F1 key into the Directory
so that each time you press the F1 key the directory of the disk
in drive A would appear on the screen. You make the change
like this:
Prompt $e[0;59;"DIR";13p $p$g
<Press the Enter Key.>
When you press the F1 key the computer automatically
"presses" the Enter key for you and the contents of the
directory appears on the screen. The F1 key will remain active
until you either cancel it or turn off the computer.
To make the F1 Macro permanent you must put it in the
Autoexec.Bat File.
AUTOEXC.BAT FILES AND LOADING THE F FUNCTION KEYS WITH
MACROS IS PRESENTED IN DISK #2.
HOW TO CANCEL AN F KEY
The rule in cancelling any key that has been
redefined (changed) is to repeat the same scan code like
this:
Prompt $e[0;59;0;59p $p$g
<Press the Enter Key.>
The key is back to its normal F1 function.
WRITING A BAT FILE FOR THE DATE AND TIME
Type the following next to the A:\> prompt, like this:
Copy Con DT.Bat
Prompt $e[1;32;45m $d $t $g
Press F6 Key, then press Enter key.
------------
-18-
PUTTING THE DT BAT FILE INTO A MACRO (See disk #2 below)
The Date-Time Bat file will be stored in
the Up arrow key. The scan code for the Up arrow is
0;72.