home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / editors / amac41.arj / BOOK19.QM < prev    next >
Text File  |  1991-08-26  |  22KB  |  466 lines

  1. *                               BOOK19.QM
  2. *              Macros To Jump To BookMarks And Read Macros
  3. *                        Written by Tom Hogshead
  4. *                                8/26/91
  5. *  Key    Subfile              Description
  6. * =====  =========  =====================================================
  7. * @(f)  {e:\up\bok001}
  8. *                 --Jump From Index Line To Macro or Item Located Either  |chg
  9. *                       In Document Below Or In A Designated Subfile
  10. * @(6)  {e:\up\bok001}
  11. *                 --Select Txtfile To Load And Read Macros From Index
  12. * @(7)  {e:\up\bok001}
  13. *                 --Select And Read Macros From Index,                    |chg
  14. *                       Txtfile Not Loaded
  15. * @(8)  {e:\up\bok001}                                                    |chg
  16. *                 --Read Macros of Subfile on Cursor Line,
  17. *                       Txtfile Not Loaded
  18. * @(0)  {e:\up\bok001}
  19. *                 --Save Current Macro Buffer And
  20. *                       Read Previously Saved Macro Buffer
  21. * @(eq) {e:\up\bok001}  @=
  22. *                 --Read Current Txtfile Macros
  23. * @(mi) {e:\up\bok001}  @-
  24. *                 --Read Previously Saved Macro Buffer
  25. * ^(f1) {e:\up\bok001}
  26. *                 --Cycle Between Starting and Selected Files
  27. *                       After Invoking @6
  28. *--
  29. * @(4)            --Jump From Index Line To First Word Enclosed
  30. *                       With ( ) In the Document Below
  31. *                       (Quicker Version of @1 That Positions
  32. *                       Cursor On First Index Selection Line)
  33. * @(1)            --Jump From Index Line To First Word Enclosed
  34. *                       With ( ) In the Document Below
  35. * @(2)            --Finds First Word On Cursor Line In Document Below,
  36. *                      "Marked" Or "Unmarked", And Encloses Selected
  37. *                       Found Word In Document With ( )
  38. * @(3)            --Copies Word At Cursor In Document To Index
  39. *                       Enclosing Word At Cursor And Word In Index With ( )
  40. * (F4)            --Continues Searching Until the Desired Word
  41. *                       Is Found In Document Below Using @2
  42. *--
  43. *    {e:\up\INDX*}--Index of Macros In AMACxx.ZIP
  44. *
  45. *  Misc
  46. * ------
  47. * (Description)    - BookMarker Macros
  48. * (Configuration)  - MUST do
  49. * (Using) Macros   - Start up and Macro Execution
  50. * (Macros)         - BookMarker Macros
  51. * (Other) Macros   - not included
  52. * (Version) history
  53. *
  54. *-- eoi
  55.  
  56.  
  57. * (Description)
  58. * --------------
  59.  
  60. *       BOOK19.QM are a series of macros enabling the user to load,
  61. *       read, and/or invoke macros located in any file.  Files, items
  62. *       or macros may be quickly located in any file by enclosing a key
  63. *       identification word in parentheses and placing the bookmarked
  64. *       word in an Index.  This version includes macros using the new
  65. *       and *not- recommended* technique of a "macro reading a macro".
  66.  
  67. *       A theoretically unlimited number of macros (in excess of the
  68. *       limited 0.5k QConfig.dat buffer) located in files other than
  69. *       the current file can be quickly located and easily executed at
  70. *       any time using either @f, @6, @7 or @8 while editing any file.
  71. *       (See bok001.qm for additional discussion).
  72.  
  73. *       For anyone using more than a few macros and who might be tight
  74. *       on QConfig macro buffer space, the macros in bok001.qm may be
  75. *       of interest; they are allowing me to have immediate access while
  76. *       editing any file, to quickly load and run over 300 macros in
  77. *       about 50 files compiled to more than 20,000 macro bytes -- and
  78. *       with 150 bytes QConfig macro buffer space to spare. I am still
  79. *       testing and improving these macros, and so far I'm encouraged.
  80. *       Beware, these macros are not for the feint of heart <grin> !
  81.  
  82. *       The techniques, necessary configuring, and use of these
  83. *       bookmark macros require a considerable knowlege of QMAC and
  84. *       QEdit macro language. The new techniques they involve have not
  85. *       been fully tested.  These are my first real effort to have a
  86. *       macro read a macro, a heretofore (and still) not recommended
  87. *       procedure. Until this "macro reading a macro" technique can be
  88. *       fully tested and proven to be viable, I do *not* advise the
  89. *       user use this technique in other macros without full knowledge
  90. *       of it's pitfalls and limitations.
  91.  
  92.  
  93. * (Configuration)  - MUST do
  94. * ---------------------------
  95.  
  96. *       In order to access files and/or invoke macros in different
  97. *       directories, all files listed in 'e-up.lst' MUST be configured
  98. *       for the user directory containing AMAC files.  My directory,
  99. *       e:\up, occurs over 100 times and must be changed using the
  100. *       following configuration procedure which takes a few minutes
  101. *       to do the search/replace and compile using QMAC:
  102.  
  103. *       1. Make a two letter directory on your hard drive named \UP.
  104. *          If this conflicts, then any two letter directory will
  105. *          suffice.
  106.  
  107. *       2. First expand all files in AMACxx.ZIP to \UP directory.
  108.  
  109. *       3. Change to \UP directory.
  110.  
  111. *       4. Replace 'e:\up\' with  [ dir:\ ] in all files in the file
  112. *          list 'e-up.lst' using SRQ.BAT search/replace batch file from
  113. *          SRCHxx.QM:
  114.  
  115. *                   SRQ.BAT  e:\up\  [ dir:\ ]  @e-up.lst  <enter>
  116.  
  117. *          e.g. if c:\up is your directory containing AMAC files:
  118.  
  119. *                   SRQ.BAT  e:\up\  c:\up\     @e-up.lst  <enter>
  120. *                                    ^^^^^^
  121.  
  122. *          BOOKxx v 1.8 used SR.BAT.  The total size of files in
  123. *          e-up.lst is almost 400k and greater than the QEdit can
  124. *          handle, so we must either use SRQ.BAT as shown here, or
  125. *          repeat the search/replace using SR.BAT until all
  126. *          replacements have been made.
  127.  
  128. *       5. After the search/replace is complete, exit QEdit and convert
  129. *          changed txtfiles to macfiles using QMAC with the following:
  130. *                   E-UP.BAT
  131.  
  132. *       6. Put the following bok001.qm macro in QCONFIG.DAT, changing
  133. *          dir:\ to your directory containing AMAC files:
  134.  
  135. *             @f macro_begin macroread "[ dir:\ ]bok001.mac" return
  136.  
  137. *          e.g.,
  138.  
  139. *             @f macro_begin macroread "c:\up\bok001.mac" return
  140. *                                       ^^^^^^
  141.  
  142. *       7. The following macros in bok001.qm should also be installed
  143. *          in QConfig.dat and then commented out of bok001.qm after
  144. *          installation.  They will then be available in any editing
  145. *          session as long as no subsequently installed macros have the
  146. *          same keys.
  147.  
  148. *          ^f1  Cycle Between Starting and Selected Files After Invoking @6
  149. *          @0   Save Current Macro Buffer, Read Previously Saved Macro Buffer
  150. *          @=   Read Current Txtfile Macros
  151. *          @-   Read Previously Saved Macro Buffer
  152.  
  153. *       8. After completion of steps 4 and 5 above, changing c:\ to a
  154. *          ram drive in all macros in bok001.qm will increase macro
  155. *          execution speed, although this in not necessary.
  156.  
  157.  
  158. * (Using) Macros
  159. * ---------------
  160.  
  161. *       The following examples demonstrate the use of macros in
  162. *       bok001.qm using @6 and @f.
  163.  
  164. *       To execute bok001.qm macros, be sure Insert is ON and then:
  165.  
  166. *       1. Load BOOK19.QM into a QEdit window.
  167.  
  168. *       2. Read the macfile bok001.mac as follows:
  169. *             @f  <enter>
  170. *          Macros @f and all other macros in bok001.qm are now loaded.
  171.  
  172. *       3. Run @6.  Cursor down to desired txtfile in INDXxx.QM to load
  173. *          the selected txtfile, and press <enter>.  At the next pause,
  174. *          cursor down to desired macro to load it's txtfile and read
  175. *          it's macros. Selecting @f will load subfile bok001.qm  and
  176. *          read it's macros, with the cursor positioned on a
  177. *          description of @f.
  178.  
  179. *       4. Press ^f1 to cycle between BOOK19.QM and bok001.qm
  180.  
  181. *       5. Press @6 again to select, load and read another set of
  182. *          macros.
  183.  
  184. * These macros require "QEdit and QMAC v2.1, February, 1990" or later.
  185.  
  186. * (Other) Macros: See ALLMACRO.INF for other macros.  See also
  187. *                 JMPPOSxx.QM for macros to jump to positions within
  188. *                 and across files using position markers.
  189.  
  190.  
  191. * (Macros)
  192. * ---------
  193.  
  194. * 
  195. * -------------------------------------------------------------------------
  196. * @(1) Jump To First Word On Cursor Line "Marked" In The Document Below
  197. * -------------------------------------------------------------------------
  198. *
  199. *        @1 macro has 2 steps:
  200. *
  201. *        1. Press Alt and 1 at the same time. Line 1 is marked to
  202. *        highlight. Cursor down to desired line in Index.
  203. *
  204. *        2. Press Enter. The macro then jumps to the first word
  205. *        cursor line in the document below.
  206.  
  207. *        @1 differs from @f in that @1 will only find an Index item or
  208. *        macro in the current file.  @f will find them in an unlimited
  209. *        number of files.
  210.  
  211. @1 macrobegin
  212.         unmarkblock                     * Unmark any marked blocks
  213.         defaultwordset                  * In case altwordset on
  214.         begfile markline markline       * And highlight line 1
  215.         pause                           * Pause for Index selection
  216.         wordright markword              * Mark first word on line
  217.         copy                            * Copy word to scrap
  218.         endpara                         * Go to end of Index
  219.         find "(" paste ")"              *
  220.         return "I" return               * Find first marked word in doc
  221.     jfalse NOMARK:                      *
  222.         begline                         * If mark found go to begline
  223.         maketopofscreen scrollup        * Cursor on line 2                |a
  224.     jump END:                           *
  225.     NOMARK:                             *
  226.         begfile                         * If no mark found go to begfile
  227.     END:
  228. *
  229. * 32 bytes Tue  09-11-1990  11:19:51
  230. * 33 bytes Wed  06-26-1991  11:23:27 (TH @1, added defaultwordset)
  231. * 33 bytes Fri  07-05-1991  10:31:13 (TH @1, moved makectrofscreen down)
  232. * 33 bytes Wed  07-10-1991  10:11:24 (TH @1, moved makectrofscreen back up)
  233. * 34 bytes Sun  07-28-1991  15:48:33 (TH @1, changed found cursor pos |a)
  234.  
  235. * Here a QMAC compiled version of @1 that will fit on a single line in
  236. * QConfig.dat:
  237.  
  238. * @1      MacroBegin UnmarkBlock DefaultWordSet BegFile MarkLine
  239. *         MarkLine Pause WordRight MarkWord Copy EndPara Find "(" Paste
  240. *         ")" Return "I" Return JFalse Label0: BegLine MakeTopOfScreen
  241. *         ScrollUp Jump Label1: Label0: BegFile Label1:
  242. * 34 bytes Sun  07-28-1991  15:48:33 (TH @1, changed found cursor pos |a)
  243.  
  244. * This above version of @1 is 34 bytes. You may want to use the
  245. * following shorter version (22 bytes) where searching starts from
  246. * cursor line, not at the end of the first paragraph of the (Index), as
  247. * above:
  248.  
  249. * @1 macrobegin
  250. *        unmarkblock                    * unmark any marked blocks
  251. *        defaultwordset                 * in case altwordset on
  252. *        begfile                        * go to file begin endline
  253. *        markline                       * highlight to show 'on'
  254. *        markline                       *
  255. *        pause                          * pause for Index selection
  256. *        wordright markword             * mark first word on line
  257. *        copy                           * copy word to scrap
  258. *        find "(" paste ")" return      * find first marked word in doc
  259. *        return
  260. *        begline                        * if mark found go to begline
  261. *
  262. * 21 bytes Tue  09-11-1990  11:22:45 added markline
  263. * 22 bytes Wed  06-26-1991  11:23:27 (TH @1, added defaultwordset)
  264.  
  265. * 
  266. * -------------------------------------------------------------------------
  267. * @(4) Jump To First Word On Cursor Line "Marked" In The Document Below
  268. *      Positions Cursor On First Index Selection Line For Quicker Selection
  269. * -------------------------------------------------------------------------
  270.  
  271. * This macro is an alternate version of @1 that positions the cursor on
  272. * the first Index selection line instead of the top line as @1 does.
  273. * This enables the user to more quickly make a selection to jump to.
  274.  
  275. @4 macrobegin
  276.         unmarkblock                     * Unmark any marked blocks
  277.         defaultwordset                  * In case altwordset on
  278.         begfile                         *
  279.         endpara                         * Move to end of Index
  280.         markline                        * Mark it
  281.         begfile                         * Move to bof
  282.         find "(" return "L" return      * Locate first Index selection line
  283.     jfalse NOMARK:                      *
  284.         makectrofscreen                 * Show top of file
  285.         begfile                         * Move back to bof
  286.         unmarkblock markline markline   * And highlight line 1
  287.         prevposition                    * Move back to first selection line
  288.         begline                         * Cursor in col 1
  289.         pause                           * Pause for Index selection
  290.         wordright markword              * Mark first word on line
  291.         copy                            * Copy word to scrap
  292.         endpara                         * Go to end of Index
  293.         find "(" paste ")"              *
  294.         return "I" return               * Find first marked word in doc
  295.     jfalse NOMARK:                      *
  296.         begline                         * If mark found go to begline
  297.         maketopofscreen scrollup        * Cursor on line 2
  298.     jump END:                           *
  299.     NOMARK:                             *
  300.         begfile                         * If no mark found go to begfile
  301.     END:
  302. *
  303. * 34 bytes Sun  07-28-1991  15:48:33 (TH @1)
  304. * 52 bytes Wed  07-31-1991  14:43:31 (TH @4 in BOOKxx.QM)
  305.  
  306. * Here's a QMAC compiled version of @4 that will fit on a single line in
  307. * QConfig.dat:
  308.  
  309. * @4      MacroBegin UnmarkBlock DefaultWordSet BegFile EndPara
  310. *         MarkLine BegFile Find "(" Return "L" Return JFalse Label0:
  311. *         MakeCtrOfScreen BegFile UnmarkBlock MarkLine MarkLine
  312. *         PrevPosition BegLine Pause WordRight MarkWord Copy EndPara
  313. *         Find "(" Paste ")" Return "I" Return JFalse Label1: BegLine
  314. *         MakeTopOfScreen ScrollUp Jump Label2: Label0: Label1: BegFile
  315. *         Label2:
  316. * 52 bytes Wed  07-31-1991  14:43:31 (TH @4)
  317.  
  318.  
  319. * 
  320. * ----------------------------------------------------------------------
  321. * @(2) Finds Word In Document, Adds () To Found Word And Returns To Index
  322. * ----------------------------------------------------------------------
  323. *
  324. *      @2 macro has 3 steps:
  325. *
  326. *       1. Press Alt and 2 at the same time. The macro finds first word
  327. *       on the cursor line in the document below. If first found word
  328. *       is not the desired occurrence, press F4 for next word or until
  329. *       the desired occurrence is found.
  330. *
  331. *       2. When the desired word and location are found, press Enter.
  332. *       The macro places () around desired found word and then return
  333. *       to the original word in the Index.
  334. *
  335. *       3. Press Enter again and the macro places () around the original
  336. *       word in the Index. The cursor ends at end of the marked word in
  337. *       the Index so comments may be added. Be careful not to mark the
  338. *       same word more than once or only the first occurrence of the word
  339. *       in the document will be found with @1 and @f.
  340. *
  341. @2      macrobegin                      *
  342.         defaultwordset                  * in case altwordset on
  343.         wordright markword              * mark first word on line
  344.         copy                            * copy word to scrap
  345.         find paste return "I" return    * find first word in doc          |a
  346.         pause                           * pause for Enter or F4
  347.        "("                              * place ( in front of word
  348.         markword                        * markword
  349.         gotoblockend ")"                * place ) at end of word
  350.         pause                           * pause for Enter if OK
  351.         begfile                         * go to file begin
  352.         find return delline return      * find selected word doc          |a
  353.         pause                           * pause for Enter if OK
  354.         markword                        * markword
  355.         gotoblockbeg "("                * place ( in front of word
  356.         gotoblockend ") "               * place ) at end of word
  357.         unmarkblock                     * unmark word
  358. *
  359. * 35 bytes Sat  07-28-1990  15:17:55
  360. * 36 bytes Wed  06-26-1991  12:13:45 (TH @2, added defaultwordset)
  361. * 38 bytes Sun  07-28-1991  16:24:04 (TH @2, changed Find's |a)
  362.  
  363. * 
  364. * ----------------------------------------------------------------------
  365. * @(3)  Puts Word @ Cursor In Index With () Around Marked Word And In Index
  366. * ----------------------------------------------------------------------
  367. *
  368. *        @3 macro has 2 steps:
  369. *
  370. *        1. Press Alt and 3 at the same time. Macro marks the word at the
  371. *        cursor in the document, then returns to the the end of the Index.
  372. *        The marked word in the document is then copied at the end of the
  373. *        Index with () around it. The cursor is at end of word so
  374. *        comments may be added in the Index.
  375. *
  376. *        2. Press Enter and the cursor returns to the beginning of
  377. *        the line of the marked word in the document.
  378. *
  379. @3      macrobegin                      *
  380.         defaultwordset                  * in case altwordset on
  381.         markword                        * mark word at cursor
  382.         gotoblockbeg "("                * place () around word
  383.         gotoblockend ")"                *
  384.         copy                            * copy word and ) to scrap
  385.         begfile                         * go to file begin
  386.         endpara                         * go to end of Index
  387.         addline                         * add one extra line              |
  388.         begline "*"                     * insert star in col 1 at eoi     |
  389.         cursorright                     * make one space                  |
  390.         "("                             * insert "("                      |a
  391.         paste                           * paste word and ")" to eoi       |
  392.         endline                         * insert ")" in end of word       |
  393.         cursorright                     * make one space                  |
  394.         unmarkblock makectrofscreen     * unmark word and ()              |
  395.         pause                           * pause for comments and if OK
  396.         begline wordright markword      * mark word
  397.         copy                            * copy word to scrap
  398.         find "(" paste ")" return return * return to word in doc
  399.         begline                         * go to line begin
  400. *
  401. * 42 bytes Sat  07-28-1990  15:18:04
  402. * 43 bytes Wed  06-26-1991  12:13:32 (TH @3, added defaultwordset)
  403. * 41 bytes Sun  07-28-1991  16:16:19 (TH @3, shortened |a)
  404.  
  405. * 
  406. * ----------------------------------------------------------------------
  407. * (f4) Continues Until Desired Word Is Found Using @2
  408. * ----------------------------------------------------------------------
  409. *
  410. *       (see @2 for use)
  411. *
  412. f4      repeatfind                      * repeat find until desired word
  413.                                         *  & location are found
  414. * 5 bytes Sat  07-28-1990  15:18:17 (TH @4)
  415.  
  416.  
  417. * (QEdit)    is not a marked Index word
  418. * (unmarked) is not a marked Index word
  419. * (be)       is not a marked Index word
  420. * (window)   is not a marked Index word
  421.  
  422. * (Version) History
  423. * -------------------
  424. *   1.0 - initial
  425. *   1.1 - changed document
  426. *   1.2 - modified @1 to keep normal cursor line color before selecting
  427. *         an indexed word. Macro now does not find marked words in Index.
  428. *   1.3 - changed document BOOK13.QM
  429. *   1.3a- Changed other file names in series, this is an update.
  430. *   1.4 - Changed down arrow #25 to ! in @1.
  431. *       - Changed .LST and .QL
  432. *   1.5 - Modified @1 to highlight line 1 rather than ! at end
  433. *   1.5a- Modified this file.
  434. *   1.5b- Modified this file and added START.BAT.
  435. *   1.6 - Modified @1, @2 and @3 to start with defaultwordset.
  436. *       - Moved makectrofsccreen in @1 down.
  437. *   1.6a- Added @space to update @f in files.
  438. *       - Added @f to load and read an unlimited number of macros.
  439. *       - Included v1.6a in AMAC39.ZIP, July 21, 1991.
  440. *   1.7 - Changed @space to @5. @space key can only be used if
  441. *         NewKey is loaded,  July 23, 1991.
  442. *       - Added @6 and @7 in bok001.qm to load and read macros from
  443. *         an Index of all text files containing macros,  July 25, 1991.
  444. *       - Modified @1, @2 ans @3,  July 28, 1991.
  445. *       - @f was not reading subfile macros if key was not found.
  446. *         Corrected and further modified, July 28, 1991.
  447. *       - Included in AMAC39A.ZIP, July 29, 1991.
  448. *   1.8 - Added keys capability in INDXxx.QM.                          7/30/91
  449. *       - Added @4, 'quicker' version of @1 IN BOOKxx.QM               7/31/91
  450. *       - Added @0, @= and @- to bok001.qm.                            7/31/91
  451. *       - Added 'Save Current Macro Buffer' to @6, @7 & @f bok001.qm.   8/1/91
  452. *       - Added @8 to read only subfile macros at cursor line.          8/4/91
  453. *                   (ver 1.8 in AMACxx.ZIP, v4.0)
  454. *   1.9 - Modified @7 and @8 in bok001.qm.                              8/5/91
  455. *       - Changed configuration batch file to SRQ.BAT because total     8/9/91
  456. *         size of files in e-up.lst (approx 400k) exceeds QEdit limit.
  457. *         SRQ quits each file after replacement, SR does not.
  458. *       - Modified @f to handle odd cases.                             8/22/91
  459. *       - Encyrpted @f.                                                8/26/91
  460. *
  461. *
  462. *
  463. *
  464. *
  465. *
  466.