home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / vdehelp.lbr / VDEHLP.LBR / MACROS.HQP / MACROS.HLP
Encoding:
Text File  |  1993-10-25  |  6.9 KB  |  108 lines

  1. Macro Definitions
  2. Macro Keys
  3. Macro Programming
  4. :A
  5. MACRO (ESC-M) -  A "macro" is a string of VDE commands and text that, once 
  6.     defined, can be repeated automatically.  When you type ESC-M you will be 
  7.     asked for the string, then a "Repeat count".  Usually you will simply type 
  8.     a number for the repeat count (0-9, or "*" for "indefinitely").  You will 
  9.     see the results as the macro executes, and you can abort it at any time by 
  10.     pressing ESC.
  11.          (If you are sure you know what you're doing, you can speed up Macro 
  12.     execution by specifying "Quiet" mode: press "Q" before the repeat count.  
  13.     Only the header will be updated as the Macro runs.)
  14.          Macros also stop any time an error occurs; the error message will be 
  15.     visible, and can be cleared by pressing ESC.  Many commands (like Find or 
  16.     Reformat) are designed to generate errors at the end of the file so that 
  17.     an indefinite ("*") Macro containing them will halt there.  Other 
  18.     indefinite Macros may need to be aborted manually.
  19.          VDE turns INSERT OFF before running a macro, so that the same key 
  20.     sequence will always have the same effect.  The INSERT status is restored 
  21.     when the macro terminates.
  22.          In order to include any input line editing characters (BS, CR etc) in 
  23.     a macro, you must prefix them with ^P.  (NOTE:  To make them easier to 
  24.     read and understand, Macro listings will be given here as they function, 
  25.     not as they are typed in.  ^P prefixes as needed are NOT shown.  Key- 
  26.     strokes are separated by dashes or commas for clarity, and "_" means a 
  27.     space or blank.)  Here are some sample Macros:
  28.          1.  View a file by scrolling slowly through it:
  29.                              ESC-;,^C
  30.     This will pause, then scroll down.  (Use a repeat count of "*".)
  31.          2.  Can you figure out what this one does?  (Answer:  .elif eht fo 
  32.     dne eht ta meht fo tsil a gnikam elif a fo tuo sesehtnerap ni stnemmoc 
  33.     ekat lliw tI)
  34.            ^QR,^QF,(,CR,^G,^KB,^QF,),CR,^G,^KK,^QC,CR,^KV
  35.          VDE Macros are very powerful tools, particularly given their program- 
  36.     mability and storage on function keys.
  37. :B
  38. MACRO KEY (ESC-#,0..9) -  Up to 10 Macros can be stored (0..9), by entering 
  39.     them with the ESC-M command, then using ESC-# to save them.  They can then 
  40.     be recalled and used simply by typing ESC-number.  Example: typing ESC-#-0 
  41.     will store the last Macro used as Key 0, and it can be recalled and reused 
  42.     at any future time simply by typing ESC-0.
  43.          Ordinarily, Keys operate just like the original Macro:  they will ask 
  44.     for "Repeat count" when executed.  If you want to suppress this (giving 
  45.     something more like a "function key", that only executes once) you can 
  46.     type "N" (for No repeat) before storing the key number.  Example:  ESC-#-N- 
  47.     0 stores a Macro in Key 0 as a no-repeat key sequence.  If you also don't 
  48.     need to see the Key work, and want to make it faster, you can make it 
  49.     QUIET as well by typing "Q" instead (for Quiet) before the key number.  
  50.     Example:  ESC-#-Q-0 stores to Key 0 as a quiet no-repeat key sequence.
  51.          If the Macro (ESC-M) string is empty, using ESC-# will delete a Key 
  52.     definition.  Using a defined Key brings its definition into the Macro 
  53.     buffer (whence it can be stored again if desired).  Trying to use an 
  54.     undefined Key results in an error.
  55.          There are 500 bytes total available for all 10 keys, and a 128 byte 
  56.     limit for any one Key.  (VDE's own input line will only accept 65 bytes, 
  57.     but VINSTALL can handle up to the full 128.)
  58.          USAGE HINT: If you want to re-use a macro without having to type it 
  59.     in again, use ESC-# to assign it to a key, then call it up by number.
  60.          Besides simply storing Macros, here are some useful function Keys:
  61.        1.  Storing different sets of margins (eg for quotes): for example,
  62.                              ^OL,12,CR,^OR,66,CR
  63.        2.  Typing any frequently repeated phrase; "ESC-6" is much more 
  64.     convenient than "^PSWorld Wide Widgets Ltd. (N.A.)^PS".
  65.           [VINSTALL allows you to install a default set of macro Keys.  Thus 
  66.     VDE can be customized for any task, such as the formatting requirements 
  67.     of specialized writing or programming languages.]
  68. :C
  69. MACRO PROGRAMMING (ESC-0..9, ESC-!,=,~,+,;) -  VDE has several commands which 
  70.     function only in a Macro string, and give you control over the execution 
  71.     of a macro, allowing real programming.
  72.          ESC-0..9, when in a Macro, function simply as "labels" 0..9.  They 
  73.     have no effect, but can be "jumped" to by other commands.
  74.          ESC-! followed by 0..9 is a simple "jump" instruction, causing macro 
  75.     execution to resume with the command following the label ESC-0..9.  
  76.     Example: ESC!2 jumps to label 2.  As two epecial cases, ESC-![ jumps to 
  77.     the beginning of the Macro, and ESC-!] jumps to the end (aborts).
  78.          ESC-= and ESC-~, followed by a character and then a label 0..9 (or 
  79.     "[","]"), are conditional jumps: they jump to that label IF the character 
  80.     at the cursor position does (or for "~", doesn't) match that specified.  
  81.     Example: ESC~^M2 jumps to ESC-2 if the current character is NOT a CR.
  82.          ESC-= and ESC-~, followed by a character and then ">" or "<", are 
  83.     search loops.  They will continue to move the cursor right (or for "<", 
  84.     left) as long as the character at the cursor does (or for "~", doesn't) 
  85.     match, or until the beginning or end of the file.  Example: ESC=_> moves 
  86.     right as long as the current character is a space.
  87.          ESC-+, followed by 0..9, is used to "chain" to another macro key.  In 
  88.     this way you can build up strings longer than the 65/128-byte limit on any 
  89.     one key.  It does not "call" the key; there is no returning.  Example: 
  90.     ESC+9 chains to Key 9.
  91.          ESC-; (semicolon) gives a brief pause, presumably so the user can see 
  92.     what's happening on screen.
  93.          Macro programs are stored just like any other macro string (usually 
  94.     with "N"o repeat count).  If you program in an endless loop, you will at 
  95.     some point have to abort with ESC.  Don't make macro programs "Q"uiet 
  96.     until you're sure they work.
  97.          Example: here is a good macro program (best stored as a Quiet Key) to 
  98.     move the cursor to the start of the current sentence:
  99.               ESC~.1, ^S, ESC1, ESC~.<, ESC2, ^D, ESC=_2, ESC=^M2
  100.     You could write this out in programmer's pseudo-code as:
  101.               If not "." goto label1
  102.               Move left                 ;move left if already on period
  103.      label1:  While not "." move Left   ;move left to previous period
  104.      label2:  Move right                ;now move back right
  105.               If " " goto label2        ;  as long as you see a space
  106.               If "^M" goto label2       ;  or a Return
  107.               (all done)
  108.