Atari XL Benutzerhandbuch

Seite von 77
The Last Word 3.0 Reference Manual 
 
7-47 
 
7.6  EXAMPLE MACROS 
 
The best way to illustrate the creation of macros is with some useful examples. 
 
DUAL FONT LOADER 
 
When loading fonts into LW, only the font relevant to the current display mode is 
normally loaded, i.e. if LW is in 80 column mode and you specify a font to load, only 
the 80 column (.F80) font is loaded, while the 40 column font remains unchanged. You 
can, however, load the “other” font by specifying the file extender when loading fonts. 
For example, if LW 
is in 40 column mode and you load the “MACRO.F80” font, the 
underlying 80 column font will be loaded while the current 40 column font will remain 
unchanged. 
 
What if you wanted to load both the 40 and 80 column fonts at the same time? We can 
write a macro which will function as a new command for loading both types of font. 
 
We’ll put the macro on the <SHIFT+CTRL+O> keystroke, so create an empty file and 
type <Shift+Esc>, then <Select+ Ctrl+O>. Then type <Shift+Esc>, <Select+=> to get 
the assignment character. Now we can type the commands which actually make up 
the macro. 
 
The first thing we want to do is capture the name of the font set to load. We do this 
using the Macro Ask command. So we type <Shift+Esc>, <Select+Ctrl+A> to get the 
macro ask character. This is followed by the input prompt we wish to appear on the 
screen. Type: 
 
Font Set 
 
Press <Return> to end the string. Next, we need to stop the macro issuing keystrokes 
until the user has a chance to type the name of the font set and press <Return>. This 
is done with the macro input command, so we type: 
 
<Shift+Esc>, <Select+Ctrl+L> 
 
Now press <Return> - this adds the <Return> which the macro will issue to terminate 
the user’s input (when the user presses <Return> while the macro is suspended during 
input, that <Return> is not issued to the input line: it merely tells the macro we have 
finished entering text. That’s why we have to issue the <Return> character explicitly to 
terminate text input to the macro ask command. 
 
The string captured by the macro ask command is stored in the paste buffer. It’s stored 
there because it allows the resulting text to be easily inserted into the document. We 
can also place the contents of the paste buffer back into the input line of another 
command, using the <CTRL+B> (Paste Buffer) command. That’s what we’re going to 
do now: place the font name the user provided into the Load Font command’s input 
line. 
 
So the next character we need in the macro is <Shift+Esc>, <Select+Ctrl+N>. We then 
type <Shift+Esc>, <Ctrl+B>, followed by .F80, and finally a <Return>. This simply adds 
“.F80” to the name the user typed, signifying that we wish to load the 80 column font. 
To load the corresponding 40 column font, we type the same line again, except that 
this time we add “.FNT”.