home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
UTILS
/
S
/
VDEMAC2.ZIP
/
VDEMAC2.DOC
next >
Wrap
Text File
|
1990-04-13
|
12KB
|
289 lines
============
VDEMAC2.DOC
============
Some Ideas for Programming the Macro
Keys in Video Display Editor v2.63
In an earlier release, VDEMACRO.LBR, I presented some discussion
of the way I had programmed my Macro Keys in the version of VDE I
use for straight word processing. This release is a continuation
of that discussion, using some of the new macros I have devised
since then.
As before, I am including a VDE.VDK file with the macros under
discussion, so you can load it into a copy of VDE and test the
way the macros work. To install the macros, do
A0>vinst263 vdecopy vdemac2.vdk
and S)ave VDECOPY.COM with the macros installed. If, while in
VINST263, you look at the Key Macro option, you will see that the
installed keys look like this:
MACRO KEYS: (0159 bytes free)
<0><Q>^C^C^C^E^E^E^E^E^[^E
<1><Q>^Qs^X^[=^M]^[= ]^S^V ^D^[![
<2>^[=^M0^V^I^V^B^G^[![^[0^X
<3>^[=^M0^T^B^N^[0^X
<4><Q>^VQr^[r^P^[^P^I^P^K^P^[9
<5><Q>^[rA0:LH.FMT^M
<6><Q>^[b^X^X^X^X^X^X^[t^[d^C^C^X^X^X^X^X^X^X^X^X^X^[^X^[^X
<7><Q>^V@@@ ^[s^[lVDE.A^M^Qf@@@ ^M^G^G^G^G
<8><Q>^V@@@ ^[s^[lVDE.B^M^Qf@@@ ^M^G^G^G^G
<9><Q>^[rHEADER^M
In many of these macros I have used the basic VDE ESC commands
rather than their WordStar-style synonyms with ^K, because some
users will not have installed their copies of VDE to take
advantage of the extended WordStar command set compatibility. In
the discussion below I refer to the basic VDE ESC commands, with
the WS-type synonyms in parentheses.
As the first four keys, Macros 1 through 4, have not changed
since the earlier release, I leave discussion of them to the end
and start with Macro 5.
ESC5: LETTERHEAD
<5> <Q> ^[r A0:LH.FMT ^M
I've added the spaces here to make the code a little easier to
read. The <5> is the number of the Key Macro and is supplied by
VINST263. The <Q> is for Quiet operation of the Macro. You are
prompted to specify <N> for No repeat or <Q> for Quiet _after_
you have entered the main body of the Macro. This one is very
simple. The ^[r (^Kr) is the VDE/WordStar command to "read in" a
file, in this case a file called LH.FMT in the A0 directory. The
trailing ^M is the carriage return that enters the read command.
Keeping a letterhead in a text file called LH.FMT in A0 rather
than programming it into VDE has several advantages. Since LH.FMT
is an ordinary text file it is much easier to rewrite, with VDE
itself or with any other word processor, and reading in a file
this way is actually considerably faster than having VDE write
the letterhead out character by character.
Any file could be could be temporarily renamed LH.FMT to be used
as a second letterhead or as any other chunk of boilerplate you
have to read in repeatedly.
ESC-6: DELETE HEADER
<6> <Q> ^[b ^X^X^X^X^X^X ^[t ^[d ^C^C ^X^X^X^X^X^X^X^X^X^X ^[^X^ [^X
I use this macro to delete a header, either to clear up a mistake
or to prepare a document for repagination, but all it does is
delete six lines from your text - any six lines, not just a six-
line header.
The ^[b (^Kb) code at the beginning plants a head-of-block
marker, the string of ^X's moves the cursor down six lines, the
^[t (^Kk) plants the end-of-block marker, and ^[d (^Ky) erases
the block. The remaining code moves the cursor down by two
screens and then a number of lines. The ^[^X (ESC-CTRL-X) codes
reposition the cursor in the middle of the screen.
The purpose is to move the cursor on by one page to the beginning
of the next header, which you may delete or not, as you see fit.
The distance the cursor travels is determined by the default page
length of 58 lines. If you change that, you will have to make
some adjustment to this macro.
ESC-7 AND ESC-8: SWITCH BETWEEN TWO FILES
<7> <Q> ^V @@@_ ^[s ^[l VDE.A ^M ^Qf @@@_ ^M ^G^G^G^G
<8> <Q> ^V @@@_ ^[s ^[l VDE.B ^M ^Qf @@@_ ^M ^G^G^G^G
Here again I've added spaces to separate the elements of the
commands for clarity, and underlines to indicate real spaces that
are included in the actual macros.
It is rare for CP/M editors to permit work in two files, but
these two Key Macros allow you to switch back and forth quickly
between two files named VDE.A and VDE.B. How quickly this happens
depends on the length of the files and where you are running
them. If you are using very long files on floppy disks, this may
be too slow to be worthwhile. It works a good deal faster on a
hard disk, of course, and on a RAM disk it's virtually
instantaneous.
The ^V puts VDE into INSERT mode so the following "@@@ " will not
overwrite anything. This marks the current position of the
cursor. The ^[s (^Ks) saves the file you are in to disk and the
^[l (^Kl) loads a new file called VDE.A or VDE.B. As soon as it
is opened VDE searches for the pattern "@@@ ", and, if it finds
it, erases it, leaving the cursor at the position where the
cursor was previously left in that document. If VDE doesn't find
the pattern it reports [not found] and you have to hit ESC to
continue.
I have entered the names of the two files in such a way that the
A file will be on the left, ESC-7, and the B file will be on the
right, ESC-8.
There are several ways to use this capability, depending on how
and when you rename files VDE.A and VDE.B. If, for instance, you
are interrupted while working in a document and want to jot down
a quick phone number and address, you can just hit ESC-8, make
your note, save it, and reload your original file.
If you are using EASE or another command line history processor
it can be even faster to exit with a ^[x (^Kx) and simply recall
the last command, which will be VDE YOUR.DOC, search @@@, delete
it, and go back to work. You can later retrieve your note - plus
any others you've added to it - by recalling VDE.A.
If you want to switch between two files repeatedly, use the ^[n
(^Kn) command to rename the file you are in to VDE.A before
hitting ESC-8. When VDE.B comes up it will probably be empty. Use
^[r (^Kr) to read the second file in without changing the name.
From then on ESC-7 and ESC-8 will repeatedly switch between the
two files, returning you to your cursor postion in each of them.
When you are ready to quit, rename the files to their permanent
names and save them to disk.
Be aware that the last version of an A or B file saved to disk
will have the "@@@ " code in it somewhere. This will be no
problem if you rename and save while you are in VDE, but there
could be a problem if you rename and save after quitting VDE.
Remember that you can freeze eleven lines of text in a window
with the ^Ow command, and that that text will remain in the
window even after you have switched to the other file. This can
be useful for manually copying small bits of text from one file
to another, but, for true cut and paste you still have to write a
block out of one file with ^[w (^Kw) and read it into the other
with ^[r (^Kr).
ESC-9: CUSTOM HEADER
<9> <Q> ^[r HEADER ^M
This reads in a file called HEADER which has to be prepared in
advance and stored, at least temporarily, in the default
directory. One way to use it is to go to the top of page 2 of
your document and create a header there in the form and style you
prefer, putting a # symbol rather than 2 where you want the page
number to appear. When the header is in satisfactory form, mark
it as a block and save it to disk as HEADER.
Put the cursor on row 1 column 1 of page 2 and use ESC-0 to
advance to row 1 column 1 of page 3, then use ESC-9 to copy your
header onto that page. Alternating ESC-0 and ESC-9 will put the
same header on every following page.
To add page numbers, return to the top of the document, turn
INSERT mode off, use ^Qf to search for the # symbol, and
successively replace it with the appropriate page numbers. Note
that this system makes it very easy to use complex page numbers
like 9-12 for page 12 of chapter 9, for example. It also makes it
very easy to alter the custom header as and when necessary, to
change chapter headings, or what have you. You can keep several
standard headers called HEADER.1, HEADER.2, or HEADER.3, reading
the desired one in with a ^[r (^Kr), modifying it if necessary,
then writing it back to HEADER with ^[w before continuing.
ESC-0: PAGE LENGTH RULER
<0> <Q> ^C^C^C ^E^E^E^E^E ^[^E
This macro advances the cursor by 58 lines, the exact length of
VDE's default page, and is used in conjunction with ESC-9. If you
alter the page length (easily done with ^OP), you will either
have to change the code for this macro or compensate for the
difference each time you invoke it. As you can see, the macro
advances the cursor by three screens with three ^C's, somewhat
overshooting the mark, then moves it up with five ^E's to the
correct position. The final ESC-^E scrolls the screen to put the
cursor more toward the center. To alter the length of the
"ruler," add to or subtract from the string of five ^E's in the
middle of the macro.
It is possible to add Macro 0 to Macro 9 if you want to automate
Macro 9 even further, either by adding the Macro 0 code to Macro
9 directly, or, if you plan to maintain Macro 0 anyway, by adding
^[#0 (ESC-#-0) which would cause Macro 9 to chain to Macro 0.
I have Macro 9 set up to run quietly and only once because I like
to check each page break for widows and orphans or other
awkwardnesses. If you prefer to set up a single header and just
let 'er rip, you could refuse to specify <N> or <Q> for Macro 9,
link it to Macro 0, and answer * to the prompt when asked for how
many times you want it to repeat.
The following Key Macros were discussed at some length in
VDEMACRO, so I'll just recall them briefly here.
ESC-1: SOFTEN PARAGRAPH
Removes all hard carriage returns from a passage of text until it
comes to a blank line, which it recognizes when it finds a
carriage retuurn in column 1. This leaves a "paragraph" ready to
be reformed with the ^B command, provided the paragraph is
defined by a blank line. Several paragraphs run together without
blank lines and distinguished by indentations will not be
recognized as separate paragraphs.
ESC-2: BLOCK TO INDENT
Transforms block paragraph style document into indented paragraph
style. It removes the blank line separating the block-form
paragraphs and replaces it with a five-space indentation.
ESC-3: INDENT TO BLOCK
Reverses sense of the command above, transforming an indented
paragraph document to block style.
ESC-4: PAGE OFFSET
Embeds my printer's control code to set a left margin in column
11. I normally put this at the very top of a document I want to
print out if I have neglected to set a left margin in some other
way. If I want an offset other than 11, I overwrite the ^K
(equals 10 decimal in the ASCII code) in the string with another
control character that will give me a different value for the
offset.
The code shown here works for the many inexpensive daisywheel
printers with the Diablo 1610 command set, and that includes many
popular Dynax, Comrex, Brother, Morrow, and other models. The
idea should be easy enough to adapt to any other type of printer.
F R E D H A I N E S
Glendale Littera RCPM/QBBS
Sysop: Abel Iwaz
[818] 956-6164 - PC Pursuit
February , 1988