home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
wp
/
pc-type3.zip
/
PCTDOC1.EXE
/
lha
/
CHAP18.TXT
< prev
next >
Wrap
Text File
|
1989-04-21
|
26KB
|
561 lines
subject: KEYSTROKE MACROS OVERVIEW
purpose: A macro is a stored sequence of keystrokes. Once you
have defined a macro you can invoke or "replay" the
macro at any time.
discussion: If you find yourself typing the same set of keystrokes
again and again, you probably want to define a macro.
PC-Type II memorizes your keystrokes as you define the
macro. Macros can be used for any PC-Type II process.
You can even have the macro pause while you enter some
unique set of keystrokes, and then continue on when
you are done.
Once a macro has been defined, you can define a
special keystroke for that macro, give it a name, and
save it in a file. You can define up to 25 different
macros per macro file and can have unlimited macro
files.
Keystrokes reserved for macros are Alt A through Alt Z
(with the exception of Alt Y). A macro can call other
macros, or can even call itself. If it calls itself,
it is called a recursive macro. A macro cannot
reference a macro in a different .MAC (macro) file.
Once a macro is defined, you can invoke the macro
whenever necessary. If an error message is issued
either during the creation of a macro, or during the
replay of a macro, the definition or replay will be
stopped. This can be particularly useful for
automatically stopping a recursive macro when it
reaches the bottom of a file.
You can change the name of a macro, delete a macro,
modify the keystrokes stored in a macro, and reassign
the macro key.
Keystroke macros cannot be used when viewing a graph
created with the Graph command, with the DOS command,
or outside of PC-Type II. When you quit PC-Type II, the
macro will stop running.
You can, however, execute a macro automatically when
you start PC-Type II. This allows you to have PC-Type
II
perform a series of keystrokes each time you start the
program. (See the section Starting PC-Type II on page
45.)
NOTE: Try to keep macros general by keeping them
independent of the configuration toggle
settings. For example, use Ctrl I to insert a
new line instead of Enter since one Enter mode
does not insert new lines.
189
subject: KEYSTROKE MACRO DEFINITION
purpose: The macro definition process memorizes a set of
keystrokes and saves them in a buffer.
discussion: While PC-Type II memorizes your keystrokes, a Y will
flash in the double line at the top left of your
screen to remind you that a macro definition is in
progress.
There are three steps for defining a macro.
(1) Start defining the macro by pressing Alt Y.
Alternatively, you can begin defining the macro by
pressing 0 from the Keystroke Macros menu shown below.
This menu appears by pressing the (M)acro option in
the Main Menu.
┌──────────────────────┐
│Keystroke Macros: │
╞══════════════════════╡
│ Y Save the Y macro │
│ 0 Begin new macro │
│ C clean up dir file │
│ P place . in filespec│
│ 1 EXIT │
└──────────────────────┘
NOTE: If no macro existed in the temporary buffer, the
line "Save the Y macro" would be shown.
When a macro definition is completed it is saved
in a temporary buffer until it is assigned its own
keystroke. If you initiate the definition of a
new macro while a previously defined macro still
resides in that temporary buffer, then the message
shown below will be displayed.
┌────────────────────────────────────┐
│Question: │
╞════════════════════════════════════╡
│ │
│Current Y macro will be lost. Okay?│
│Press Y or N │
│ │
└────────────────────────────────────┘
If you answer N, then the initiation of a new
macro is cancelled. At this point you could
permanently save the temporary macro by going to
the Keystroke Macro menu shown above, and pressing
Y to "Save the Y macro".
If you answer Y, then the macro in the temporary
buffer is erased, and the new definition proceeds.
When the new macro is initiated, a Y will flash in
the double line in the status area of your screen.
190
(2) Type the text, commands, menu options, etc. which
you want stored in the macro. These keystrokes
can include other macros which have already been
defined.
Special macro keystrokes:
Ctrl F7 - Cancels the macro definition.
If you make a mistake when defining a
macro, you can abort the macro
definition by pressing Ctrl F7 and start
over, or you can continue the macro
definition and later modify the macro to
remove any unwanted keystrokes.
Ctrl K - Temporarily suspends the macro
definition allowing you to make
keystrokes which will not be remembered.
The definition will resume as soon as
you press the Enter key.
When you press Ctrl K, a K will begin
flashing next to the Y on the double
line at the top left of your screen.
After you press Enter, the K will stop
flashing.
When you run the finished macro, PC-Type II
will process all keystrokes up to the
Ctrl K and suspend the macro until you
press the Enter key, and then continue
with the remainder of the macro
sequence.
Ctrl Ins - Forces the Insert/Overwrite mode to
Insert.
For macros to be generalized, you must
account for the state of PC-Type II when
the macro begins. For example, it is
often useful to press the Home key
before beginning a macro to be sure you
are at the left margin.
Ctrl Ins will insure that the
Insert/Overwrite state of PC-Type II is
Insert. Should you want to make sure
that the state was Overwrite, then press
Ctrl Ins followed by just Ins at the
beginning of your macro.
191
(3) Stop the macro definition by pressing Alt Y (or Ctrl
Ctrl Y).
Normally you stop the macro definition by pressing
Alt Y.
If you press Ctrl Y, then the macro is recursive, that
is, when it is run, it will repeat itself when it has
finished all its memorized keystrokes.
After pressing Alt Y or Ctrl Y, the question below
will be asked.
┌───────────────┐
│Question: │
╞═══════════════╡
│ │
│Save macro now?│
│Press Y or N │
│ │
└───────────────┘
NOTE: If a menu is displayed when you stop the
macro definition, you will not be asked if
you want to "Save macro now?".
If you answer N, the macro will only be available
during the current PC-Type II session. When you
leave PC-Type II, the macro will be lost. The macro
will also be lost if you define another macro in
the current session. Of course you can make the Y
macro permanent before defining another macro or
quitting PC-Type II.
If you answer Y, you will be asked:
Press key to be used to start new macro:
A through Z (except Y) acceptable.
Y cannot be used because Y is used to start and
stop macro definitions. If the key you select has
already been assigned to another macro, PC-Type II
gives you the option of overwriting the existing
macro, or selecting a different key.
Enter descriptive word(s) for the macro
At this point you can enter a name for the macro
you defined which will help you remember what the
macro does. These names are displayed in the
Keystroke Macros menu.
In the Keystroke Macros menu displayed on page 196,
for one macro the letter 'C' was selected and the name
provided for it was "clean up dir file". This macro
is run by pressing Alt C.
192
subject: RUNNING MACROS
general: (1) When a macro is run, PC-Type II displays a flashing M
in the upper left corner of your screen. When the
macro is finished, the flashing M will disappear.
(2) If you entered a Ctrl K in your macro, when the
macro gets to that stroke, the cursor will change
to a rectangle at the top of the character, and a
K will flash next to the M cited above. You can
type any keystrokes you want in this mode. After
you press the Enter key to finish your entry, the
K will disappear and the macro will continue.
(3) If you need to stop the macro, press Ctrl F7. (Esc
will also work under most conditions, but not when
the K is flashing.)
(4) The macro will stop when it has processed all its
keystrokes, if an error condition is encountered,
or if an attempt is made to move the cursor before
the beginning or after the end of the file.
Y macro: Once a macro has been defined and left in the macro
buffer, (i.e., not assigned a keystroke and not
assigned a name), it can be run by pressing Ctrl Y.
Assigned Macro: Once you have defined a letter key and a name to a
macro, it is no longer kept in the Y macro buffer.
These macros can be started in one of two ways.
(1) Hold down the Alt key and press the letter key
under which the macro was saved. For example,
hold down the Alt key and press C.
(2) Go the Keystroke Macros menu by selecting the
(M)acros option in the Main Menu. Then press the
letter to which the ïmacro was assigned. This
will cause a menu like the one shown below to be
displayed.
┌────────────────────┐
│ C clean up dir file│
╞════════════════════╡
│ (C)hange name │
│ (D)elete │
│ (E)xecute │
│ (M)odify │
│ (R)eassign │
│ e(X)it │
└────────────────────┘
Select the (E)xecute option by pressing E. (The
heading in this menu displays the macro you selected.)
193
subject: MODIFYING MACROS
purpose: Once a macro has been defined, given a keystroke and a
name, the keystroke, the name, and the macro itself
can be changed. It can also be deleted.
discussion: Go the Keystroke Macros menu, (select the (M)acros
option in the Main Menu), and press the letter to
which the macro was assigned.
┌──────────────────────┐
│Keystroke Macros: │
╞══════════════════════╡
│ Y Save Y macro │
│ 0 Begin new macro │
│ C clean up dir file │
│ P place . in filespec│
│ 1 EXIT │
└──────────────────────┘
In the sample Keystroke Macros menu above, C was
pressed, causing the menu below to be displayed.
┌────────────────────┐
│ C clean up dir file│
╞════════════════════╡
│ (C)hange name │
│ (D)elete │
│ (E)xecute │
│ (M)odify │
│ (R)eassign │
│ e(X)it │
└────────────────────┘
Except for the (E)xecute and (D)elete options, you
will return to this menu when you have finished the
selected option. Press X or Esc to exit the keystroke
macro menus.
The macro options available are:
(C)hange name - modify the name.
(D)elete - remove the macro after confirmation.
(E)xecute - run the macro.
(M)odify - edit/change the keystrokes in the
macro.
(R)eassign - change the key assigned to the macro.
NOTE: If you change the key assigned to a macro which
is called by other macros, those calls will not
be modified.
Except for the Execute option, these changes will not
be made permanent until you save the macros to a disk
file using the (F)ile handling option of the
Configuration Menu.
NOTE: The Y macro buffer cannot be modified until it
has been assigned a key and a name.
194
subject: EDITING MACROS
purpose: The keystrokes defined in a macro can be modified
without having to go through the steps of memorizing
keystrokes all over again.
discussion: To modify a macro, select the (M)odify option of the
second menu displayed on the preceding page. The
keystrokes in the macro are displayed where the
Command Line is located.
Letters, numbers and punctuation will be displayed
as typed. Cursor keys, Enter, function keys, Ctrl and
Alt key combinations, etc., are assigned codes.
The code characters are surrounded with { and }.
Inside {} is the key code. These codes are:
{Fx} - Function key where x is the function key number.
F10 would look like {F10}.
{Cx} - generally means Ctrl x where x is the designated
key. Ctrl B would look like {CB}.
{Ax} - means Alt x where x is the designated key. Alt 1
would look like {A1}.
{Sx} - means Shift x where x is the designated key.
Shift F10 would look like {SF10}. (This code
only works for Function keys and the Tab key.)
Other key codes you need to know are:
{EOM} - End of macro {ESC} - Esc key
{BS} - Backspace {DEL} - Del key
{DOWN} - down arrow {CDOWN} - Ctrl down arrow
{END} - End key {CEND} - Ctrl End key
{ENTER} - Enter key {CENTER} - Ctrl Enter key
{HOME} - Home key {CHOME} - Ctrl Home key
{INS} - Ins key {CINS} - Ctrl Ins key
{LEFT} - left arrow {CLEFT} - Ctrl left arrow
{PGDN} - PgDn key {CPGDN} - Ctrl PgDn key
{PGUP} - PgUp key {CPGUP} - Ctrl PgUp key
{RIGHT} - right arrow {CRIGHT} - Ctrl right arrow
{UP} - up arrow {CUP} - Ctrl up arrow
{C\} - Ctrl Backslash {C_} - Ctrl underscore
{T} - Tab {ST} - Shift Tab key
Example: The macro below was created to close a letter with a
blank line, then type the string "Sincerely,", three
blank lines, and the name "Dick".
{CI}{CI}{HOME}Sincerely,{CI}{CI}{CI}{CI}{HOME}Dick{EOM}
NOTE: When you edit a macro, it should end with {EOM},
(end of macro), so that spaces at the end will
not be lost.
195
subject: SAVING KEYSTROKE MACROS
purpose: In order to use a defined macro in another PC-Type II
session, it must be saved to disk.
Y macro: If the defined macro is still in the temporary buffer,
(called the Y macro), then it must first be assigned a
keystroke before it can be saved to disk. This is
accomplished by:
(1) accessing the Keystroke Macro Menu (select the
(M)acros option from the Main Menu).
(2) selecting the Save the Y macro option by pressing Y.
(3) assigning a key to the macro and giving the macro
a name as discussed on page 198.
Macros to disk: Macros which have been assigned keystrokes and given
names, can be used by holding down the Alt key and
pressing the key assigned to the macro. However, they
must be saved to disk in a .MAC file to be available
for other PC-Type II sessions.
To save a set of macros to disk, select the (F)ile
handling option in the Configuration Menu. Press 3
(Macro file to disk), and you will be asked to enter a
path and a filename for the set of macros. (PC-Type II
will assign the file extension .MAC automatically.)
.MAC format: A .MAC file is an ASCII file and can be edited. In
the ensuing discussion, refer to the example below.
The first line of a .MAC file is a header line which
specifies the number of Keystroke macros in the file.
Following the header line is the first macro. Its
assigned key is in parentheses followed by the macro
name. Finally, each keystroke in the macro is given.
NOTE: Since macro names can be 25 characters long, at
least 25 character positions should be left
between the beginning of the macro name and the
beginning of the macro keystroke description.
Many macros require more than one line. Each line of
a keystroke definition must begin with a \ character.
If the line ends with a \ character it implies another
line of keystrokes for the same macro follows. The
macro should end with the {EOM} (end of macro) code.
(See Editing Macros for a definition of the keystroke
codes).
example: PC-Type II Macros 2
(C) clean up dir file \{CPGUP}{F5}{F5}{F5}{F5}\
\{CPGDN}{F5}{END}{EOM}
196
subject: LOADING .MAC FILES
purpose: You can save macros in numerous .MAC files. To be
able to execute macros saved in these files, they must
be loaded into PC-Type II.
discussion: Macros can be loaded from disk into PC-Type II in 3 ways:
(1) By reference in the .PRO file loaded at the start
of a session or during a session. (See the
section Configuration Files on page 108.)
(2) Loaded directly from the (F)ile Handling option in
the Configuration Menu. (See the section
Configuration Files on page 118.)
(3) As a command line option when PC-Type II is started
from DOS. In this option, even if the .PRO file
loaded contains a reference to a macro file, the
command line option will override that reference
and load the macro file specified. (See Command
Line Options in the section Starting PC-Type II.)
When a different set of macros is loaded, the previous
set is no longer available for use until it is
reloaded.
197
subject: MACRO HINTS
purpose: By following certain conventions, macros can be made
more general and useful.
discussion: As a general rule, always try to define a macro in
such a way as to be independent of specific PC-Type II
states.
It is safer to begin macros from either the text area
or from the Command Line. If a macro is started from
a menu, you must insure that you are in that same menu
before starting the macro for it to work properly.
If you want a macro to always begin in the text area,
you should begin it with a keystroke, or combination
of keystrokes to guarantee that it is in the text
area, such as Ctrl Home or the down arrow followed by
the up arrow.
If you want a macro to always begin on the Command
Line, do the same as above and followed by Esc.
It is useful to begin a macro with the Home key to
insure the cursor is positioned at the left margin of
the text or the home position of the Command Line.
It is a good practice to insure that the
Insert/Overwrite state is always in the same condition
when defining a macro. Ctrl Ins insures that it is in
the Insert state. Ctrl Ins followed by Ins insures
that it is in the Overwrite State.
Insure that no highlighting exists when you begin a
macro which highlights text areas. Begin such macros
with Ctrl U.
Use F10 when possible to execute commands. It is very
powerful when used in conjunction with recursive
macros.
Finally, give the macros meaningful names when you
save them. It is easy to forget what function a macro
performs, and long macros are not easy to read.
NOTE: .MAC files are ASCII files and can be edited.
We recommend, however, that you modify your
macro files inside PC-Type II. Errors are far
less likely to occur.
198