CFOG's PIP, June 1987, Volume 5 No. 8, Whole No. 56, page 5

VDE Macro Key Definitions

by Benjamin H. Cohen

I was working on the documentation file for PC-File 80 with VDM because it's fast. I had to break it down into five separate parts because it was over 124K bytes and my O-1 with Drive C: RAM disk and Presto! installed has a small TPA (Transient Program Area, the part of memory in which programs run and where VDE puts the file to be edited). It worked fine. I found a couple of uses for VDM's macro keys that others might find helpful.

One of the perennial problems is saving files. I wrote a series of five macros using VINST, into a copy of VDM that I reserve for editing the PC-File documentation. Each macro looks like this:


I've broken the macro down into three lines to fit PIP's format. When defining the macro with VINST you'll enter the entire macro on one line. Now let's parse the macro:


The first three characters stand for [ESC]n. That tells VDM to change the name of the working file. Next I've specified drive B: and the filename PCFILE.001. You have to press the <cr> to tell VDM you've completed the filename: the ^M shows that. The next three characters, ^[s, stand for [ESC]s, the VDE command to save the file under the current working name. This macro didn't seem to work the first time I tried it so I added a ^W for a short wait.

The next line of the macro is just the same, except that the working file has been moved to drive C:. The third line changes the working file to drive A:, the RAM disk, and saves it again.

Since there are five parts to the whole document, I made up five macros, saved on macro keys 1 through 5. Of course I don't take a chance that I'll hit the wrong key. I load the file from one of my two working floppy disks and then put two otherwise empty disks into drives B: and C:. If I hit the wrong macro key I won't wipe out a file by mistake! Another macro I set up while working on this file is one to reform the current paragraph and then move the cursor back to the place where it was when I hit the key. Here it is:


The ^P^Z puts a place marker in the file. ^B reformats the paragraph. ^Q^P moves to the place marker. ^H moves the cursor back one space to the place marker and ^G deletes it.

Of course, if you have other place markers in the file this won't work correctly. That's not a very good solution to the problem, so I devised another one that's more or less foolproof.

A more or less foolproof method of doing this would create a macro like this


This one sticks a string of three "x"s in your text, reformats, goes to the top of the file, searches for the three "x"s and replaces them with nothing. I say "more or less" foolproof, since if you have a string of three "x"s somewhere in the file you'll wind up there instead of where you expected. Of course, you could use a more unlikely string. This works so fast there's no reason not to do it.

Setting formats is another nice trick for VDM macros. You could simply set the margins: "^O^L5<cr>^O^R58<cr>". (Remember, you have to use a ^P before the <cr> to get it into the macro or macro definition.) That will set the left margin at 5 and the right margin at 58 for indented quotations in legal briefs. But I sometimes forget which function key is which. So, in order to avoid mistakes, first I jump to the left margin, then I insert a carriage return, then I set the left margin to one, then I enter two periods and the text "left margin 5 right margin 58", and then and only then come the margin setting comands. You can easily hit ^Y to get rid of the extra line of text, but it won't print if you use NewWord or WordStar to print your files.

The macro string is:

..left margin 5, right margin 58

Again, I've broken the macro down to three lines to fit PIP's format, but you would enter it as one string.