============ VDEMACRO.LBR ============ Some Useful Macro Key Definitions for Eric Meyer's Video Display Editor v2.6x The macro key feature of Eric Meyer's VDE enormously extends the range ¨ and power of this small, simple, and speedy word processor. This file ¨ discusses the permanently installed macros I use. Some of them may be ¨ of use to you as they are, and you may want to adapt some of the ideas ¨ to your own uses. VDE262.VDK is the one I use routinely in my straight word processing ¨ version of VDE. You can install it in a test copy of VDE to see how ¨ these particular macros work. The macro key codes look like this when ¨ called up by VINST262: MACRO KEYS: (00D6 bytes free) <0>F R E D H A I N E S^M^M733 north king's road apt 331^M los angeles, california 90069^Mtelephone [213] 658-8664^M <1>^Q^S^X^[=^M]^S^V ^V^D^[![ <2>^[=^M0^V^I^V^B^G^[![^[0^X <3>^[=^M0^T^B^N^[0^X <4>^N^N^N^N^N^N^M^M^Mpage #^O^F^G^G@@@^E^E^E^E^E^E^E^E^C^C^C <5>^N^N^N^N^N^N^M^M^M- # -^O^C^G^G^E^E^E^E^E^E^E^E^C^C^C <6>^Qa^P^M^M ^P^M^M*^[^Qr <7>^P^[^P^I^P^K^P^[9 <8>^[~ <^[0^^^[~ 0 Select <0-9> or ap; or to exit: I've folded lines 1 and 9, but this is more or less what you'll see. ESC-0 - LETTERHEAD Macro ESC-0 types my letterhead to the screen - on the left side, ¨ since I prefer a flush left style, but it could be modified to print ¨ in the center or at the right without too much trouble. The in ¨ angle brackets is added at the end of typing the macro in, when you ¨ are asked to select for "no repeat," or for quiet. There's no ¨ particular reason to watch this happening, and is faster. ESC-9 - BOLDFACE LETTERHEAD ESC-9 goes back and make the letterhead boldface by adding CTRL-D's to ¨ the beginning and end of each line. ¨ <9>^V^[~F<^P^D^Q^D^P^D^D^D^P^D^Q^D^P^D^D^P^D^Q^D^P^D^D^P^D^Q^D ^P^D^D The code immediately after the ^V (to switch insert mode back on, ¨ since VDE always switches insert off when it executes a macro), ^[~F<, ¨ is the VDE code which causes the cursor to search backwards until it ¨ reaches a capital F, and the rest of the line is more or less self ¨ explanatory. It embeds a ^D, issues a ^QD to skip to the end of the ¨ line, embeds another ^D, and so forth. If your first name doesn't ¨ begin with F you would have to substitute your own initial, of course, ¨ and, if that is duplicated elsewhere in the letterhead, you would have ¨ to repeat the ^[~(initial)< code. Another way to do this, if you want to use the letterhead only at the ¨ top of your document, is to code the macro to go to the top of the ¨ document with a ^QR, then search forward instead of backward for the ¨ initial letter. I use two separate macro keys partly because the text exceeds the ¨ allowable limit of characters for a single macro key, and partly ¨ because I like to choose whether to make the letterhead boldface or ¨ not. In fact these macros are overly fancy - it's just as easy to keep a ¨ file with the letterhead in it and read it in with a ^KR command - but ¨ they do illustrate some features of VDE's macro facility. You can ¨ keep a letterhead block file in any user area, because the ^KR command ¨ lets you specify the directory as well as the file name. ESC-1 - MAKE PARAGRAPH REFORMABLE ESC-1 replaces all hard carriage returns from the cursor position to ¨ the end of the paragraph with soft carriage returns, allowing ¨ reformatting with ^B. <1>^Q^S^X^[=^M]^S^V ^V^D^[![ The coded commands first return the cursor to the beginning of the ¨ line, then drop it down one line. The special VDE macro code ^[=^M] ¨ is a conditional jump to the end of the macro - quitting - if the ¨ character under the cursor is a carriage return, as it would be if the ¨ cursor were on the blank line at the end of a paragraph. This macro treats paragraphs which aren't separated by a blank line as ¨ a single paragraph. If you use an indented first line as the ¨ indication of a paragraph, you have to add hard carriage returns where ¨ you want them before reforming. ESC-2 AND ESC-3 - CHANGE PARAGRAPH FORM ESC-2 and ESC-3 are companion pieces. I prefer to work in flush left ¨ block paragraph style with a blank line to denote the paragraph (like ¨ this document), but I often have to reformat a document in normal ¨ indented paragraph style without blank lines between, particularly ¨ when preparing for publication - editors want indented paragraphs and ¨ doublespacing. If you put the cursor at the head of the text and do ESC-2, VDE ¨ automatically convert the entire document to indented form. To ¨ doublespace, set doublespace with ^OS, go back to the top, and set up ¨ a temporary macro (ESC-M) with nothing but ^B repeated with the * ¨ command. ESC-3 reverses the process. First singlespace the document, ¨ then run ESC-3 on it. <2> ^[=^M0 ^V^I^V ^B^G ^[![ ^[0^X [spaces added for clarity] <3> ^[=^M0 ^T^B^N ^[0^X The sequence ^[=^M0 is a conditional jump to label 0 if the character ¨ at the cursor is a carriage return. If it isn't a carriage return, ¨ the code proceeds to the next sequence, ^V^I^V, which switches insert ¨ mode on, does one tab (I have a tab fixed at column six for the ¨ standard 5-column indentation), and switches insert off again - ¨ necessary because this macro loops. ^B reformats the paragraph and the ^G deletes the blank line between ¨ paragraphs. A ^G is safer than a ^Y here, because it accomplishes the ¨ same purpose, removing a blank line, by deleting a single character, ¨ the carriage return. If something goes awry and it tries to operate ¨ on a non-blank line, you will lose only the first character, not the ¨ whole line. The ^[![ is a special case of the jump-to-label instruction which ¨ jumps to the beginning of the macro and runs it again. If the cursor ¨ is then on a carriage return instead of the beginning of a paragraph, ¨ the ^[=^M0 causes a jump to the ^[0 label and the ^X, which pushes the ¨ cursor go down another line to search for the beginning of the next ¨ paragraph. This macro, ESC-2, could actually be set up for either no repeat ¨ or quiet, since it loops of its own accord, but I prefer to watch ¨ what's happening in case of anomalies in my formatting - you can ¨ always abort a running macro by hitting ESC. The ^[=^M0 and ^[0^X codes in ESC-3 work just as they do in ESC-2, and ¨ the code between simply does a ^T to remove the indentation, a ^B to ¨ reformat the paragraph, and a ^N to force a blank line before the next ¨ paragraph. This macro does not loop on its own, so you have to ¨ specify at runtime how many times you want it to repeat. ESC-4 AND ESC-5 - CUSTOM HEADERS ESC-4 and ESC-5 are also companion pieces - both produce custom ¨ headers. If you put your cursor on the first line of page 2 and do ¨ ESC-4, the macro will force 6 clear lines for a 1" top margin, then ¨ put a header on line 4 that looks like this: @@@ page # It then measures off a full page (of 58 lines on a 66-line page) and ¨ positions the cursor at line 1 of page 2. Since I like to control ¨ exactly where the page break comes I normally run this macro only ¨ once, but specifying the * (continuous) command will put the header on ¨ one four of every page of the document. Best not to do in quiet mode, ¨ because the macro doesn't really know when it has run out of text and ¨ will go on adding header lines endlessly. I then number the pages by doing a repeated ^QF on the symbol # and ¨ numbering the pages in sequence. I then do a temporary macro - ¨ ^QF@@@^MText - to replace the @@@ with whatever "Text" I choose. It's ¨ better to use a macro than a straight ^QF to do this, since "Text" ¨ will be written in non-insert mode and will not displace the page ¨ number over on the right. ESC-5 is very similar to ESC-4, but makes a less formal header that I ¨ use for short documents like personal letters, a simple - # - in the ¨ center of line 4 of every page. ESC-6 - REMOVE CARRIAGE RETURNS ESC-6 is a straightforward sequence of ordinary VDE commands which ¨ changes all the hard carriage returns in a document into soft carriage ¨ returns - space ^M. <6>^Qa^P^M^M ^P^M^M*^[^Qr The code gives the ^QA command to search all instances of ^M and ¨ replace them with space-^M, then answers the prompt for "how many ¨ times?" with *, and then returns to the top of the document. ESC-7 - SET LEFT MARGIN This macro is the one I use the most. I usually run SLM (Set Left ¨ Margin) before invoking VDE to set a left margin on my Comrex CR-II ¨ (Diablo 1610 compatible) daisywheel printer, but inevitably there are ¨ times when I forget to do so. Doing ESC-7 on the top line of the file ¨ inserts into it the printer's code for setting a left margin, ESC TAB ¨ nnH ESC 9, where nn is the ascii equivalent of the left margin column ¨ expressed in hex. In this case I use ^K = 11 decimal = 0B hex, which starts printing in ¨ column 11, leaving a 10-column, 1" left margin. This is the margin I ¨ use most frequently, but it is easy enough to vary by overwriting the ¨ ^K with another ascii code, ^F for a 5-column, 1/2" margin, for ¨ example. <7>^P^[^P^I^P^K^P^[9 The ^P's in the command line are there to embed the following control ¨ code in the file. Making it quiet with makes it marginally ¨ faster. What actually appears on your terminal's screen looks ¨ something like this: ^[ ^K^[9 All characters but the 9 are in half-intensity highlight since they ¨ are embedded control codes. The tab doesn't appear at all, except as ¨ the actual space of a default tab. ESC-8 - REVERSE CASE OF WORD This macro reverses the case of single word. <8>^[~ <^[0^^^[~ 0 The code ^[~ < moves the cursor to the left until it hits a space. ¨ The code ^[0 is a label. The ^^ is the VDE command to reverse the ¨ case of a character (that's CTRL-^). The code ^[~ 0 is a conditional ¨ jump back to the label - as long as the character at the cursor is not ¨ a space, the macro will loop back to the label and do another ^^. ¨ When it hits the space at the end of the word the macro quits. Note that the first code, ^[~ <, moves the cursor left until it finds ¨ the space before the word, which means that the cursor can be anywhere ¨ in the word when you issue the command, and the macro will still ¨ reverse the case on every character in the word. MACRO SETS It's conceivable that you would want to have more than one set of ¨ macro keys for use with different applications. VDE is so small that ¨ it isn't a big problem to keep several copies of it under different ¨ names, at least on a hard disk system, but the fact that the macro key ¨ buffer is exactly three records long makes it possible to record, ¨ store, and load the macro keys separately if you are running ZCPR3. Install a set of macro keys with VINST262. Then use DDT or any other ¨ debugger on VDE.COM. Use the M command to move the three records ¨ containing the key definitions to the base of the TPA: -m0280,03ff,0100 -g0 SAVE 3 MACRO1.SET R to make a three-record file MACRO1.SET. Then load ¨ and run it with a multiple command line: get 100 a0:vde.com;get 280 a0:macro1.set;go This concept can be broadened to load entirely different front ends on ¨ VDE. Since all customization of VDE - options, terminal, printer, and ¨ macro keys - is in the first three memory pages of the program, you ¨ can save, store, and reload as many different versions as you like as ¨ three-page front ends. To load and run: get 100 a0:vde.com;get 100 a0:vdevers1;go TEMPORARY MACROS You can of course override permanently installed macros by making up a ¨ temporary macro and installing it on a macro key with the ESC-K ¨ command. To clear the temporary macro keys and restore the ¨ permanently installed ones, just exit from VDE and reload it. Fred Haines Glendale Littera RCPM/QBBS Abel Iwaz, sysop [818] 956-6164 [PC Pursuit]