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 >
Text File  |  1990-04-13  |  12KB  |  289 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9. ============
  10. VDEMAC2.DOC
  11. ============
  12.  
  13.  
  14. Some Ideas for Programming the Macro 
  15. Keys in Video Display Editor v2.63
  16.  
  17.  
  18.  
  19.  
  20.  
  21. In an earlier release, VDEMACRO.LBR, I presented some discussion 
  22. of the way I had programmed my Macro Keys in the version of VDE I 
  23. use for straight word processing. This release is a continuation 
  24. of that discussion, using some of the new macros I have devised 
  25. since then.
  26.  
  27. As before, I am including a VDE.VDK file with the macros under 
  28. discussion, so you can load it into a copy of VDE and test the 
  29. way the macros work. To install the macros, do
  30.  
  31.    A0>vinst263 vdecopy vdemac2.vdk
  32.  
  33. and S)ave VDECOPY.COM with the macros installed. If, while in 
  34. VINST263, you look at the Key Macro option, you will see that the 
  35. installed keys look like this:
  36.  
  37. MACRO KEYS:  (0159 bytes free)
  38. <0><Q>^C^C^C^E^E^E^E^E^[^E
  39. <1><Q>^Qs^X^[=^M]^[= ]^S^V ^D^[![
  40. <2>^[=^M0^V^I^V^B^G^[![^[0^X
  41. <3>^[=^M0^T^B^N^[0^X
  42. <4><Q>^VQr^[r^P^[^P^I^P^K^P^[9
  43. <5><Q>^[rA0:LH.FMT^M
  44. <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
  45. <7><Q>^V@@@ ^[s^[lVDE.A^M^Qf@@@ ^M^G^G^G^G
  46. <8><Q>^V@@@ ^[s^[lVDE.B^M^Qf@@@ ^M^G^G^G^G
  47. <9><Q>^[rHEADER^M
  48.  
  49. In many of these macros I have used the basic VDE ESC commands 
  50. rather than their WordStar-style synonyms with ^K, because some 
  51. users will not have installed their copies of VDE to take 
  52. advantage of the extended WordStar command set compatibility. In 
  53. the discussion below I refer to the basic VDE ESC commands, with 
  54. the WS-type synonyms in parentheses.
  55.  
  56. As the first four keys, Macros 1 through 4, have not changed 
  57. since the earlier release, I leave discussion of them to the end 
  58. and start with Macro 5.
  59.  
  60.  
  61. ESC5: LETTERHEAD
  62.  
  63. <5> <Q> ^[r A0:LH.FMT ^M                                     
  64.  
  65. I've added the spaces here to make the code a little easier to 
  66. read. The <5> is the number of the Key Macro and is supplied by 
  67. VINST263. The <Q> is for Quiet operation of the Macro. You are 
  68. prompted to specify <N> for No repeat or <Q> for Quiet _after_ 
  69. you have entered the main body of the Macro. This one is very 
  70. simple. The ^[r (^Kr) is the VDE/WordStar command to "read in" a 
  71. file, in this case a file called LH.FMT in the A0 directory.  The 
  72. trailing ^M is the carriage return that enters the read command.
  73.  
  74. Keeping a letterhead in a text file called LH.FMT in A0 rather 
  75. than programming it into VDE has several advantages. Since LH.FMT 
  76. is an ordinary text file it is much easier to rewrite, with VDE 
  77. itself or with any other word processor, and reading in a file 
  78. this way is actually considerably faster than having VDE write 
  79. the letterhead out character by character.
  80.  
  81. Any file could be could be temporarily renamed LH.FMT to be used 
  82. as a second letterhead or as any other chunk of boilerplate you 
  83. have to read in repeatedly.
  84.  
  85.  
  86. ESC-6: DELETE HEADER
  87.  
  88. <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
  89.  
  90. I use this macro to delete a header, either to clear up a mistake 
  91. or to prepare a document for repagination, but all it does is 
  92. delete six lines from your text - any six lines, not just a six- 
  93. line header.
  94.  
  95. The ^[b (^Kb) code at the beginning plants a head-of-block 
  96. marker, the string of ^X's moves the cursor down six lines, the 
  97. ^[t (^Kk) plants the end-of-block marker, and ^[d (^Ky) erases 
  98. the block. The remaining code moves the cursor down by two 
  99. screens and then a number of lines. The ^[^X (ESC-CTRL-X) codes 
  100. reposition the cursor in the middle of the screen.
  101.  
  102. The purpose is to move the cursor on by one page to the beginning 
  103. of the next header, which you may delete or not, as you see fit.  
  104. The distance the cursor travels is determined by the default page 
  105. length of 58 lines. If you change that, you will have to make 
  106. some adjustment to this macro.
  107.  
  108.  
  109. ESC-7 AND ESC-8: SWITCH BETWEEN TWO FILES
  110.  
  111. <7> <Q> ^V @@@_ ^[s ^[l VDE.A ^M ^Qf @@@_ ^M ^G^G^G^G                       
  112. <8> <Q> ^V @@@_ ^[s ^[l VDE.B ^M ^Qf @@@_ ^M ^G^G^G^G                       
  113.  
  114. Here again I've added spaces to separate the elements of the 
  115. commands for clarity, and underlines to indicate real spaces that 
  116. are included in the actual macros.
  117.  
  118. It is rare for CP/M editors to permit work in two files, but 
  119. these two Key Macros allow you to switch back and forth quickly 
  120. between two files named VDE.A and VDE.B. How quickly this happens 
  121. depends on the length of the files and where you are running 
  122. them. If you are using very long files on floppy disks, this may 
  123. be too slow to be worthwhile. It works a good deal faster on a 
  124. hard disk, of course, and on a RAM disk it's virtually 
  125. instantaneous.
  126.  
  127. The ^V puts VDE into INSERT mode so the following "@@@ " will not 
  128. overwrite anything. This marks the current position of the 
  129. cursor. The ^[s (^Ks) saves the file you are in to disk and the 
  130. ^[l (^Kl) loads a new file called VDE.A or VDE.B. As soon as it 
  131. is opened VDE searches for the pattern "@@@ ", and, if it finds 
  132. it, erases it, leaving the cursor at the position where the 
  133. cursor was previously left in that document. If VDE doesn't find 
  134. the pattern it reports [not found] and you have to hit ESC to 
  135. continue.
  136.  
  137. I have entered the names of the two files in such a way that the 
  138. A file will be on the left, ESC-7, and the B file will be on the 
  139. right, ESC-8.
  140.  
  141. There are several ways to use this capability, depending on how 
  142. and when you rename files VDE.A and VDE.B. If, for instance, you 
  143. are interrupted while working in a document and want to jot down 
  144. a quick phone number and address, you can just hit ESC-8, make 
  145. your note, save it, and reload your original file.
  146.  
  147. If you are using EASE or another command line history processor 
  148. it can be even faster to exit with a ^[x (^Kx) and simply recall 
  149. the last command, which will be VDE YOUR.DOC, search @@@, delete 
  150. it, and go back to work. You can later retrieve your note - plus 
  151. any others you've added to it - by recalling VDE.A.
  152.  
  153. If you want to switch between two files repeatedly, use the ^[n 
  154. (^Kn) command to rename the file you are in to VDE.A before 
  155. hitting ESC-8. When VDE.B comes up it will probably be empty. Use 
  156. ^[r (^Kr) to read the second file in without changing the name.  
  157. From then on ESC-7 and ESC-8 will repeatedly switch between the 
  158. two files, returning you to your cursor postion in each of them.  
  159. When you are ready to quit, rename the files to their permanent 
  160. names and save them to disk.
  161.  
  162. Be aware that the last version of an A or B file saved to disk 
  163. will have the "@@@ " code in it somewhere. This will be no 
  164. problem if you rename and save while you are in VDE, but there 
  165. could be a problem if you rename and save after quitting VDE.
  166.  
  167. Remember that you can freeze eleven lines of text in a window 
  168. with the ^Ow command, and that that text will remain in the 
  169. window even after you have switched to the other file. This can 
  170. be useful for manually copying small bits of text from one file 
  171. to another, but, for true cut and paste you still have to write a 
  172. block out of one file with ^[w (^Kw) and read it into the other 
  173. with ^[r (^Kr).
  174.  
  175.  
  176. ESC-9: CUSTOM HEADER
  177.  
  178. <9> <Q> ^[r HEADER ^M                                        
  179.  
  180. This reads in a file called HEADER which has to be prepared in 
  181. advance and stored, at least temporarily, in the default 
  182. directory. One way to use it is to go to the top of page 2 of 
  183. your document and create a header there in the form and style you 
  184. prefer, putting a # symbol rather than 2 where you want the page 
  185. number to appear. When the header is in satisfactory form, mark 
  186. it as a block and save it to disk as HEADER.
  187.  
  188. Put the cursor on row 1 column 1 of page 2 and use ESC-0 to 
  189. advance to row 1 column 1 of page 3, then use ESC-9 to copy your 
  190. header onto that page. Alternating ESC-0 and ESC-9 will put the 
  191. same header on every following page.
  192.  
  193. To add page numbers, return to the top of the document, turn 
  194. INSERT mode off, use ^Qf to search for the # symbol, and 
  195. successively replace it with the appropriate page numbers. Note 
  196. that this system makes it very easy to use complex page numbers 
  197. like 9-12 for page 12 of chapter 9, for example. It also makes it 
  198. very easy to alter the custom header as and when necessary, to 
  199. change chapter headings, or what have you. You can keep several 
  200. standard headers called HEADER.1, HEADER.2, or HEADER.3, reading 
  201. the desired one in with a ^[r (^Kr), modifying it if necessary, 
  202. then writing it back to HEADER with ^[w before continuing.
  203.  
  204.  
  205. ESC-0: PAGE LENGTH RULER
  206.  
  207. <0> <Q> ^C^C^C ^E^E^E^E^E ^[^E                                 
  208.  
  209. This macro advances the cursor by 58 lines, the exact length of 
  210. VDE's default page, and is used in conjunction with ESC-9. If you 
  211. alter the page length (easily done with ^OP), you will either 
  212. have to change the code for this macro or compensate for the 
  213. difference each time you invoke it. As you can see, the macro 
  214. advances the cursor by three screens with three ^C's, somewhat 
  215. overshooting the mark, then moves it up with five ^E's to the 
  216. correct position. The final ESC-^E scrolls the screen to put the 
  217. cursor more toward the center. To alter the length of the 
  218. "ruler," add to or subtract from the string of five ^E's in the 
  219. middle of the macro.
  220.  
  221. It is possible to add Macro 0 to Macro 9 if you want to automate 
  222. Macro 9 even further, either by adding the Macro 0 code to Macro 
  223. 9 directly, or, if you plan to maintain Macro 0 anyway, by adding 
  224. ^[#0 (ESC-#-0) which would cause Macro 9 to chain to Macro 0.
  225.  
  226. I have Macro 9 set up to run quietly and only once because I like 
  227. to check each page break for widows and orphans or other 
  228. awkwardnesses. If you prefer to set up a single header and just 
  229. let 'er rip, you could refuse to specify <N> or <Q> for Macro 9, 
  230. link it to Macro 0, and answer * to the prompt when asked for how 
  231. many times you want it to repeat.
  232.  
  233. The following Key Macros were discussed at some length in 
  234. VDEMACRO, so I'll just recall them briefly here.
  235.  
  236.  
  237. ESC-1: SOFTEN PARAGRAPH
  238.  
  239. Removes all hard carriage returns from a passage of text until it 
  240. comes to a blank line, which it recognizes when it finds a 
  241. carriage retuurn in column 1. This leaves a "paragraph" ready to 
  242. be reformed with the ^B command, provided the paragraph is 
  243. defined by a blank line. Several paragraphs run together without 
  244. blank lines and distinguished by indentations will not be 
  245. recognized as separate paragraphs.
  246.  
  247.  
  248. ESC-2: BLOCK TO INDENT
  249.  
  250. Transforms block paragraph style document into indented paragraph 
  251. style. It removes the blank line separating the block-form 
  252. paragraphs and replaces it with a five-space indentation.
  253.  
  254.  
  255. ESC-3: INDENT TO BLOCK
  256.  
  257. Reverses sense of the command above, transforming an indented 
  258. paragraph document to block style.
  259.  
  260.  
  261. ESC-4: PAGE OFFSET
  262.  
  263. Embeds my printer's control code to set a left margin in column 
  264. 11. I normally put this at the very top of a document I want to 
  265. print out if I have neglected to set a left margin in some other 
  266. way. If I want an offset other than 11, I overwrite the ^K 
  267. (equals 10 decimal in the ASCII code) in the string with another 
  268. control character that will give me a different value for the 
  269. offset.
  270.  
  271. The code shown here works for the many inexpensive daisywheel 
  272. printers with the Diablo 1610 command set, and that includes many 
  273. popular Dynax, Comrex, Brother, Morrow, and other models. The 
  274. idea should be easy enough to adapt to any other type of printer.
  275.  
  276.  
  277.  
  278. F R E D   H A I N E S
  279.  
  280. Glendale Littera RCPM/QBBS
  281. Sysop: Abel Iwaz
  282. [818] 956-6164 - PC Pursuit 
  283.  
  284.  
  285. February , 1988
  286.  
  287.  
  288.  
  289.