.f3                              - # -              Chapter 13 - Macros
.rm70
.mt5
.mb5
.pl66
.tc
.tc 13. MACROS ............................................#
13. MACROS

A macro is essentially a pre recorded sequence of key strokes that you
wish to execute. Each macro may contain up to 255 characters, and is
stored in a macro file. Several macro files are provided with the Word
Fugue package. They all end with the extension .MAC  The standard one
WF.MAC will always be loaded on startup.

The files provided are:-

WF.MAC     standard macros for word processing

SINGLE.MAC definitions for box drawing characters, concentrating on
           single lines.

DOUBLE.MAC definitions for box drawing characters, concentrating on
           double lines.

GREEK.MAC  allows access to the Greek character set (as supported by
           the IBM PC)

EUROPE.MAC allows access to the European characters supported by the
           IBM PC.

PASCAL.MAC assorted macros for pascal programmers.

Each macro has an identifying character that is used to activate it or
replay it. These identifiers are the numbers 0 to 9, and the letters A
to Z. Lowercase and uppercase letters are treated the same. You can
only load one macro file at a time, but you can use macros to load
other macro files and execute macros from there. In addition you can
load a different macro file to execute a single command, and the
return to your original macro file.

You can have a set of macro files in each directory you use if
necessary, since Word Fugue looks in the current directory when
loading a macro file. When first started, Word Fugue will look for the
macro file WF.MAC in the default directory and if it does not find it
there, will look in the defined home directory.

.tc    Recording A Macro ..................................#
Recording A Macro

Before you can use macros, you need to set them up. The simplest
method is to record a sequence of key strokes. You achieve this by
pressing Alt R at the start of the sequence, and Alt R again when you
have finished. You will be prompted with a list of macros in the macro
file, and you will be asked to choose one to use as the repository of
the characters you have just recorded. Use the cursor movement keys to
highlight the macro you wish to store the keystrokes in, and press
Return. You will then be prompted for a name for the macro, which is
displayed whenever a list of available macros is displayed. Enter
something meaningful, and if possible, prefix it with the letter that
will be used to activate it.

You need to be sure that the sequence of keystrokes you enter is
correct, since they will be replayed exactly as you entered them.
However, if necessary, you can edit the stored macro command to
correct it.

.tc    Editing A Macro ....................................#
Editing A Macro

Macros recorded within WordFugue can be edited on a character by
character basis using the built-in macro editor. Enter the command Alt
E to edit a macro from the current set of loaded macros. A list of the
current macros will be displayed, and you select the one you want by
use of the cursor keys to highlight the appropriate one, and pressing
Return to select it.

First, a prompt box will ask for a new name for the macro, which you
can accept as is, or change. You should always include the activation
letter in the name, for ease when replaying. The macros numbered 1 to
9 are activated by the numbers 1 to 9, while those numbered 10 to 35
are activated by pressing the letters A to Z in that order.

The macro will appear in another window. It can be edited using the
cursor keys, and the <Del> or <Backspace> keys. Most characters you
type will be inserted literally into the macro. <CtrlBksp> will delete
the macro. <Enter> will end the session in the macro editor. <Esc>
will undo any changes made to the macro. In case you need to enter any
of these special keys as part of the macro, press the <ScrollLock> key
to enter Literal mode. In this mode, all keystrokes will be inserted
into the macro without any interpretation. In order to terminate the
edit when in this mode, you will need to press <ScrollLock> again in
order to enter the Return or ESC characters.

.tc    Saving A Macro File ................................#
Saving A Macro File

If the macro you have recorded are to be of any use in later sessions
of Word Fugue, you will need to save the file containing them. The
command sequence Alt W will save the macro file. You will be prompted
to enter a file name, with the current file name being displayed. You
can either edit it, or press Return to accept it.

If the filename already exists, you will be prompted with Overwrite
File? (Y/N) . If you enter Y the file will be overwritten. If you
press N or ESC, the file will not be overwritten. In this situation
you will need to enter the command again and type in a different file
name.

.tc    Playing Back A Macro ...............................#
Back A Macro

Having set up a macro, you can now play it back. There are several
commands available to do this.

.tc       Activate Macro 1 to 9 ...........................#
  Activate Macro 1 to 9

  These macros can be activated by pressing Alt1 to Alt9 using the
  numbers on the main keyboard above the letters. (Not the numeric key
  pad - they will not work!!). You should place you most often used
  macros in slots 1 to 9, since they are the easiest to activate.

.tc       Activate Macro ..................................#
  Activate Macro

  This command waits for the next keystroke, and if it is a macro
  identifier, activates that macro. Press Alt M or ESC (wordstar
  compatible command). The top line will display choose macro to
  apply. If you enter 0 to 9 or A to Z, the appropriate macro will be
  activated. Press any other key to abort playback.

  This command assumes that you know which macros you have available,
  and will not display any list. The macro will be replayed once.

.tc       Choose Macro From List ..........................#
  Choose Macro From List

  This command displays a list of available macros for you to choose
  from. Press Alt 0 to activate this command. You select the macro you
  want by use of the cursor control keys to highlight the one you
  want, and press Return to select it.

  The menu will disappear, and the macro will be replayed once. If you
  change your mind, press ESC to abort the command.

.tc       Replay Macro Many Times .........................#
  Replay Macro Many Times

  Press Alt - to activate this command. This command displays a list
  of available macros for you to choose from. You select the macro you
  want by use of the cursor control keys to highlight the one you
  want, and press Return to select it.

  The menu will disappear, and you will be prompted for the number of
  times to replay the macro. If you change your mind, press ESC to
  abort the command. You will be told how many times the macro can fit
  in the replay buffer. Enter a number and press Return. The macro
  will replay the number of times you entered. This is especially
  useful with the line drawing macros.

.tc       Find And Apply Macro ............................#
  Find And Apply Macro

  This function allows you to apply a macro to text that the Find /
  Replace command highlights. Press Ctrl Q M and a pop up search
  window will display. Enter the text to be searched for. You will
  then be prompted for the macro to replay. A list of available macros
  for you to choose from will be displayed. You select the macro you
  want by use of the cursor control keys to highlight the one you
  want, and press Return to select it.

  You then enter the search / replace options. Refer to the chapter on
  Find/Replace for more information on these.

  The cursor will be positioned at the end of the found text, and you
  will be prompted whether to apply the macro or not (unless you
  specified the N option for Do Not Ask). If you select Y then the
  macro you selected will be applied to the text.

.CP10
.tc       Example Macros ..................................#
  Example Macros

  1   Delete Word Left:         <CtrlLft><CtrlT>

  4   Spell check this word:    <CtrlK><CtrlT><AltS>

  D   Date dd month yyyy:       <CtrlJ><CtrlI>@@D8<Enter>

  H   HRHighness:               Her Royal Highness Queen Elizabeth II

  X   Datestamp file at EOF:    <CtrlK>0
                                <CtrlPgDn>..Changed <CtrlJ>
                                <CtrlI>@D6<Enter>
                                <CtrlJ><CtrlI>@T0<Enter>
                                <Enter>
                                <CtrlQ>0<CtrlK>0

                                Set marker 0
                                Go to bottom of file and insert text
                                ..Changed followed by a blank
                                Insert date
                                Insert time
                                Terminate line with CR
                                Return to marker 0
                                Switch off marker 0

.tc    Loading A Macro File ...............................#
Loading A Macro File

There are 2 methods of loading a Macro file, the first to load a file
for usage, and the second to load a file to replay only one macro and
then to re-load the original macro file. This second command is very
useful for extending the number of macros available by placing less
frequently used ones on a separate file.

.tc       Load A Macro File ...............................#
  Load A Macro File

  Pressing the command Alt L will prompt you for a file name to load
  as a macro file. The default extension for a macro file is .MAC. You
  may use wild cards to search the directory. If you press ESC you can
  abort the load process, and the currently loaded file remains
  loaded.

  Otherwise the new macro file will be loaded for use. You can have
  different macro files for different tasks, such as the line drawing
  macro files supplied with Word Fugue and the Pascal macros also
  supplied.

  Once a macro file is loaded using this command, it remains loaded
  until you load another file.

.tc       Temporarily Load A New Macro File ...............#
  Temporarily Load A New Macro File

  This command loads a new macro file to enable you to execute one
  command from the file. The old macro file is then reloaded. Press
  Ctrl J I M  and you will be prompted for the name of the macro file
  to load. You will then be presented with the list of available
  macros for you to select one to replay. You select the macro you
  want by use of the cursor control keys to highlight the one you
  want, and press Return to select it.

  The macro will be replayed once, and then the original macro file
  will be reloaded. If you change your mind, you can press ESC at any
  stage, and the process will abort and the original macro file will
  reload.
