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

  1. *                               SRCH30.QM
  2. *          Macros To Search/Replace In Text Files And ZIP Files
  3. *                        Written by Tom Hogshead
  4. *                                8/11/91
  5. *
  6. * @(0)*  Search/Replace From Command Line:
  7. *                 -  SR.BAT                                               |chg
  8. *                 -  SZR.BAT, search/replace files within ZIP files       |chg
  9. * @(4)   Search/Replace From Command Line, Quit Each File After Replacement:
  10. *                 -  SRQ.BAT
  11. * @(6)   Search From Command Line:
  12. *                 -  SM.BAT  (uses MAXFIND)
  13. * @(7)*  Search From Command Line:
  14. *                 -  SRL.BAT
  15. *                 -  SZ.BAT, search files within ZIP files, no replace
  16. *         * NOTE:Same macro @7 used for SZ and SRL batch files
  17. *                Same macro @0 used for SR and SZR batch files
  18. *                    (See batch files for instructions)
  19. *         >>>>>>> (Macros @0_4_6_7 cannot be run while editing) <<<<<<<
  20. *
  21. * @(1)─┐ Makes FileList of files containing search text while editing
  22. * @(2)─┤ Loads FileList of files containing search text while editing
  23. * @(8)─┘ Search/replace while editing loaded files only,                  |chg
  24. *           saves ONLY & keeps loaded ONLY files w/replacements
  25. * @(5) - Search/replace while editing, finds/loads files                  |chg
  26. * @(9) - Search ONLY loaded files, keep loaded ONLY files w/ found text   |chg
  27. * ^(f1_) Find multiple search text in current file, uses FGREP.COM
  28. * ^(f2_) Find multiple search text in current file, uses Dos FIND
  29. * ^(f3_) View another occurrence of search text in current file
  30. * (F4) - RepeatFind
  31. * (F5) - PrevFile
  32. * (F6) - NextFile
  33. * @(a)   Moves cursor to first word delimiter after wordleft
  34. * @(f)   Moves cursor to first word delimiter after wordright
  35. * ^(a_)  Moves cursor to first character of wordleft
  36. * ^(f_)  Moves cursor to first character of wordright
  37. * @(h) - Select Index item with cursor line, then <enter>
  38. *
  39. * (CursorLeft)  Wrap cursor to previous line like Wordstar does
  40. * (CursorRight) Wrap cursor to next       "    "     "       "
  41. *       (These two macros, written by Tim Farley, are commented out)
  42. *
  43. * (Index) Use      - How to locate macro or item below from Index using @h
  44. * (Description)    - Search/Replace Macros
  45. * (Startup)        - What's required
  46. * (Environment) Variables
  47. * (Required) Program Files
  48. * (Macros)
  49. * (Other) Macros
  50. * (CAUTION) <<<<<<<<<<<<<<<<<<< IMPORTANT
  51. * (Version) history
  52. *
  53. *-- eoi
  54.  
  55.  
  56.  
  57. *                Confirms  Saves    Must Be
  58. *                Replace-  Loaded   First
  59. * Key Run While  ment?     Files?   Macro? (1)        Comments
  60. * ──  ─────────  ────────  ──────   ────── ───  ───────────────────
  61. * @6  cmnd line  srch only n/a      yes     m   s/o w/SM.BAT
  62. * @7  cmnd line  srch only n/a      yes     f   s/o w/SRL.BAT/SZ.BAT
  63. * @0  cmnd line  no        yes      yes     f   s/r w/SR.bat/SZR.BAT
  64. * @4  cmnd line  no        yes/quit yes     f   s/r w/SRQ.bat
  65. * @1─┐editing    n/a       n/a      no      f   makes FileList only
  66. * @2─┤editing    n/a       n/a      no      f   loads files only
  67. * @8─┘editing    no        rpl only no      f   s/r loaded files
  68. * @5  editing    no        rpl only no      f   s/r finds files
  69. * @9  editing    srch only no       no      f   s/o loaded files
  70. * ^F1 editing    srch only no       no      f   s/o current file
  71. * ^F2 editing    srch only no       no      f   s/o current file
  72. * ^F3 editing    n/a       no       no          view another occurrence
  73. * ---------------
  74. * (1) Uses  m- MAXFIND, f - FGREP.COM
  75.  
  76. * (INDEX) USE; To locate a macro or item in this file, press @h, place
  77. * the cursor line on the desired item in the Index above, and press
  78. * <enter>. See BOOKxx.QM for more details.
  79.  
  80. * (DESCRIPTION): (SRCH30) are QEdit macros to search/replace and search
  81. * only files containing search text from a file pattern or a FileList
  82. * of file patterns to search using FGREP.COM and MAXFIND. Only files
  83. * containing the search text are loaded automatically, and then the
  84. * desired search/replace is performed. Search/replace may be done from
  85. * the command line and while editing files. Search or search/replace
  86. * may be also performed on ZIP files without manually unzipping and
  87. * rezipping.
  88.  
  89. * In addition to SR, SRL, and SRQ batch files, two additional batch
  90. * files are provided to search and replace files within ZIP's. SZ.BAT
  91. * and SZR.BAT are batch files using FGREP.COM to search and
  92. * search/replace text within ZIP's without having to manually unzip,
  93. * search, replace, and then rezip. For example, at the command line:
  94.  
  95. *                  SRZ  fff  FFF  TEST        <enter>
  96.  
  97. * finds all occurrences of "fff" in files within TEST.ZIP and replaces
  98. * it with "FFF". Files containing "fff" are loaded after replacement so
  99. * each replacement can be viewed before re-zip. The user is given the
  100. * option of updating each ZIP on a file by file basis before re-zipping.
  101.  
  102. * Batch file SM.BAT is also provided to search text files with MAXFIND.
  103. * SM.QM are QEdit macros to use with SM.BAT for searching files
  104. * containing a search string using MaxFind. Files are searched, found,
  105. * and loaded for editing or viewing. The search string, file names, and
  106. * other input or search options may be specified at the command line or
  107. * entered at the option query prompt. "Fuzzy", "and/or", and "sliding
  108. * window" text searches can be done.
  109.  
  110. * If you wish to do 'case sensitive' search/replace, modify SR.BAT as
  111. * follows:
  112. *         FGREP.COM -flc /%S~~%/  %file% >c:\$.ql
  113. *                      ^
  114.  
  115. * (STARTUP):
  116. * To BEGIN, just type "START SRCH" <Enter>. All pertinent files will be
  117. * loaded in the "Ring" for viewing, and SRCH30.MAC is read.
  118. * Alternatively, type "START SRCH 0" <Enter> and the disk copies of all
  119. * files in the "Ring" will be loaded ready for editing, saving time.
  120.  
  121.  
  122. * To perform a search/replace from the command line, type SR, and
  123. * answer the prompts for search and replace text. To perform a SEARCH
  124. * ONLY from the command line, type SRL, and answer the prompts for
  125. * search text. All searches with these macros and batch files are
  126. * Case insensitive. To perform a case sensitive search, change "GIN"
  127. * to "GN"in the macros below and "-f" to "-fc" in the batch files.
  128.  
  129. * Search and replacement text may be single or multiple words only
  130. * when answering search and replacement query prompts, not from the
  131. * command line.
  132. *
  133. * Replacing C: with your ram disk will make the macros run faster.
  134.  
  135. * (ENVIRONMENT) VARIABLES:
  136.  
  137. * All search and search/replace batch files use environment variables.
  138. * Some environment variables can be set to facilitate use of these
  139. * batch files, however setting any environment variable is optional. If|2.9
  140. * any or all of the following environment variable are *not* set (ie   |
  141. * "SET [name]= " the user will be prompted for the required inputs, or
  142. * values can be specified at the command line as described in each
  143. * batch file.
  144.  
  145. * a) "SET OPT=off" will bypass the option query prompt in SRL.BAT and
  146. *     SM.BAT, and bypass the File Name query prompt in SR.BAT and
  147. *     SRQ.BAT.
  148.  
  149. * b) "SET OPT= " will *not* bypass the option query prompt in SRL.BAT
  150. *     and SM.BAT, and will *not* bypass the File Name query prompt in
  151. *     SR.BAT and SRQ.BAT.
  152.  
  153. * c) "SET FILELIST=srch-fg.lst" searches with standard file list
  154. *     srch-fg.lst in SR.BAT, SRL.BAT and SRQ.BAT. SM.BAT uses the
  155. *     program MAXFIND which cannot search from filelists.
  156.  
  157. * d) "SET FILELIST=c:\srch-fg.lst" searches with standard file list
  158. *     c:\srch-fg.lst in SR.BAT, SRL.BAT and SRQ.BAT.
  159.  
  160. * e) "SET FILELIST=sm.lst" searches with standard file list sm.lst
  161. *     for testing SR.BAT, SRL.BAT and SRQ.BAT. SM.LST is provided in
  162. *     AMACxx.ZIP. SM.LST is just one line "*.tst" to search SM.TST, and
  163. *     any other files with extension .tst.
  164.  
  165. * f) "SET FILELIST= " will prompt for file name(s) or an @filelist at
  166. *     the File Name query prompt. The batch files are written to use
  167. *     file list SM.LST if nothing is entered at the File Name query
  168. *     prompt.
  169.  
  170. * the macros used with these batch files must either be located in the
  171. * current directory from which we are searching, or the location of
  172. * these macros must be specified with the environment variable SRMAC as
  173. * follows:
  174.  
  175. * g) "SET SRMAC= " means macro files are located in current directory
  176. *     from which we are searching.
  177.  
  178. * h) "SET SRMAC=c:\" means macro files are located in c:\ directory.
  179. *     c:\ may be any drive:\path\ terminating with a \.
  180.  
  181. * By default, SZ.BAT and SZR.BAT create, and delete afterwards, a      |
  182. * temporary directory c:\$zip$ into which the ZIP file is un-zipped. It|
  183. * is preferable to use a ram drive for speed. An alternative temporary |
  184. * directory can be used by setting the environment variable SZTEMP as  |
  185. * follows:                                                             |
  186.                                                                        |2.9
  187. * i) "SET SZTEMP= " uses default directory c:\$zip$ for the temporary  |
  188. *     directory.                                                       |
  189.                                                                        |
  190. * j) "SET SZTEMP=e:\name" uses directory e:\name (no trailing \) for   |
  191. *     the temporary directory.                                         |
  192.  
  193.  
  194. * Here's my SRCH-FG.LST:
  195.  
  196. *         *.qm
  197. *         *.ql
  198. *         *.inf
  199. *         *.bat
  200. *         *.lst
  201. *         *.me
  202. *         *.doc
  203. *         *.syn
  204. *         e:\syn\sa.syn
  205. *         u:\sr?.bat
  206.  
  207. * the SA.SYN entry is my PCED synonym file. The batch files have more
  208. * information and instructions.
  209.  
  210. * the following temporary environment variables are set during batch
  211. * file operation and need not be set by the user:
  212.  
  213. *         S~~     search text
  214. *         R~~     replacement text
  215. *         file    File Name or file list specified at query prompt or
  216. *                 at the command line.
  217.  
  218. * All environment variables remain as set during operation so they may
  219. * be viewed with SET afterwards.
  220.  
  221. * ******* (CAUTION) ***********
  222.  
  223.   *************************************************************************
  224.   * Alt_0/4/6/7 set and use the Dos environment variables S~~ and R~~.    *
  225.   * the letters "S~~" and "R~~" must NOT occur in any other Dos           *
  226.   * environment variable name or value. If any files being searched have  *
  227.   * attribute set Read Only, macros will stop when they try to save a     *
  228.   * Read Only file after replacements have been made.                     *
  229.   *************************************************************************
  230.  
  231. * You must have enough environment space to store both the search and
  232. * replacement text. I suggest at least 100 bytes.
  233.  
  234. * QEdit must be named Q.EXE.
  235.  
  236. * Insert should be ON.
  237.  
  238. * For (other) macros, see ALLMACRO.INF.
  239.  
  240. * these macros require "QEdit and QMAC v2.1, February, 1990" or later.
  241.  
  242. * (REQUIRED) PROGRAM FILES
  243. *
  244. * You──MUST──have the executable program files in AMAC-PRG.ZIP to run
  245. * some of these macros. AMAC-PRG.ZIP can be found on the following BBS's:
  246. *
  247. *                                 SemWare
  248. *                                 Exec-PC
  249. *
  250. * It can NOT be found on CompuServe since many of the programs are
  251. * Copyrighted. All program files are ShareWare, and inclusion in
  252. * AMAC-PRG.ZIP is not prohibited in their documentation.
  253. *
  254. * FGREP.COM.ZIP and INPUT.ZIP are the only files necessary to run SR.BAT,
  255. * SRL.BAT and SRQ.BAT. MAXFND23.COM and INPUT.COM are the only files
  256. * necessary to run SM.BAT. FGREP.COM, DX.EXE,  PKZIP.EXE and PKUNZIP.EXE
  257. * are required to run SZ.BAT and SZR.BAT.
  258. *
  259. * FGREP.COM can be found on Exec-PC as FGREP172.ZIP. INPUT can be found on
  260. * Exec-PC as INPUT.ZIP. I understand FGREP.COM v2.00 is released but as of
  261. * April 25, 1991  I have not been able to locate it on EXec-PC or
  262. * CompuServe. MAXFIND v2.3 can be found on CompuServe IBMSYS Lib 3 as
  263. * MAXFND.ZIP and on EXec-PC as MAXFND23.ZIP
  264.  
  265. * See SR.BAT and SZR.BAT for files required to search/replace within
  266. * Zip's.
  267.  
  268. *
  269. * AMAC-PRG.ZIP contains:
  270. * ----------------------
  271. * Name          Length    Method     SF   Size now  Mod Date
  272. * ============  ========  ========  ====  ========  =========
  273. * INPUT.ZIP         3097   Stored     0       3097  07 May 86
  274. * MAXFND23.ZIP     24247   Stored     0      24247  26 Apr 90
  275. * RJ.ZIP            9965   Stored     0       9965  01 Dec 90
  276. * FGREP172.ZIP     12513   Stored     0      12513  19 May 90
  277. * DX211.ZIP       100895   Stored     0     100895  17 Mar 89
  278. * AMAC-PRG.INF      3138  Imploded   67       1014  23 Apr 91
  279. * ============  ========  ========  ====  ========  =========
  280. * *total     6    153855  ZIP 1.10    0%    152329  23 Apr 91
  281. *
  282. * these files are probably on many other BBS's also.
  283. *
  284. * I thank the authors for these excellent programs.
  285.  
  286. * (Macros):--------------------------------------------------------
  287.  
  288. * 
  289. *┌─────────────────────────────────────────────────────────────────────┐
  290. *│ @(0) Macro for search/replace from command line with SR.BAT         │
  291. *└─────────────────────────────────────────────────────────────────────┘
  292. *  ******** MUST BE FIRST MACRO IN FILE FOR START UP IN SR.BAT*********
  293. *            ****** MUST RUN SR.BAT TO USE THIS MACRO******
  294. *
  295. * To do a search/replace from command line, just type SR, and answer
  296. * prompts for search and replacement text.
  297. *
  298. * SRCH.TST is included to show how this macro works. Type/enter at the
  299. * command line as follows:
  300. *
  301. *  1.   "SR"  <enter>
  302. *  2.   "aaa" space "bbb" <enter>   (answer SEARCH text prompt)
  303. *  3.   "aaa" space "BBB" <enter>   (answer REPLACEMENT text prompt)
  304. *  4.    SRCH.TST <enter>           (answer FileList prompt)
  305.  
  306. * See SR.BAT to enter parameters at command line.
  307.  
  308. * This version of @0 also uses the "Once-Around the ring" technique of
  309. * Kyle Watkins. This macro is smaller and faster than Version 1.8 and
  310. * prior because files are loaded by NextFile rather than EditFile, and
  311. * SET >c:\$ is moved to the SR.BAT batch file from the macro.
  312.  
  313. * When finished running with the batch file or PCED, the following
  314. * files are loaded for viewing or editing:
  315. *
  316. * Window 1   c:\!  List of files found & search text (output from FGREP.COM)
  317. * Window 2...n+1 = Files containing search text, n = # files with search text)
  318. *
  319. * IT CANNOT BE RUN WHILE EDITING!
  320. *
  321. * Temporary file names are:
  322. *
  323. * NUL      NUL file
  324. * c:\$.ql  List of files found & search text (output from FGREP.COM)
  325. * c:\!     Same as c:\$.ql
  326. * c:\$     Output of Dos SET.
  327.  
  328. *
  329. @0      MacroBegin
  330.         altwordset                      * For all file names
  331. * ------------------ display "No found text" message -----------------*
  332.         cursordown cursorup             * Test if any search text found
  333.         jtrue START:                    * If found, move on
  334.  MESSAGE:                               *
  335.         "No found text "                * If not found, display this
  336.         jump END:                       * End macro if no found text
  337.  START:                                 *
  338. * ---------------------------- load files ----------------------------*
  339.         endfile                         * Get to end of file
  340.  LOADAGAIN:                             *
  341.         unmarkblock                     * Unmark last file name
  342.         find #42 "Fi" return "B"  return* Find file name
  343.  jfalse  MESSAGE:                       * No find ?, show message, end
  344.         wordright                       * Move to space
  345.         wordright                       * Move to file name
  346.         markcolumn                      * Mark it
  347.         endline                         * Get all name in block
  348.         copy                            * Copy file name to scrap
  349.         EditFile                        * Get ready to load
  350.         CurrentFilename " "             * To force return *here*
  351.         Paste Return                    * Paste file name & do it!
  352.         cursorup                        * Go to next line
  353.  jfalse ENDLOAD:                        * No more filenames? Done load
  354.  jump LOADAGAIN:                        * Check again
  355.  ENDLOAD:                               *
  356.         quit                            * Quit c:\! from ring so no rplc
  357. * -------------------- get search text to scratch --------------------*
  358.         editfile "c:\$" return          * Load set output file
  359.         find  "S~~" return return       * Find S~~                     |27
  360.         find "=" return return          * Move to =                    |
  361.         cursorright                     * Move first character         |
  362.         markcharacter                   * Mark it                      |
  363.         endline                         * Move to end of text          |
  364.         storescrbuff "S~~" return       * Store SEARCH text to scratch |
  365. * ------------------- get replace text to scratch -------------------*
  366.         unmarkblock                     * Get ready
  367.         begfile                         * Get to top
  368.         find  "R~~" return return       * Find R~~                     |2.7
  369.         find "=" return return          * Move to =                    |
  370.         cursorright                     * Move first character         |
  371.         markcharacter                   * Mark it                      |
  372.         endline                         * Move to end of text          |
  373.         storescrbuff "R~~" return       * Store REPLACE text to scratch|
  374.         killfile                        * Kill c:\$ for next time
  375.         quit                            * Remove c:\$ from ring
  376. * --------------- get search/replace text from scratch ---------------*
  377.         Editfile "NUL" Return           * Insert -or- GoTo NUL File
  378.         getscrbuff "S~~" return cut     * Cut search text from scratch |2.7
  379.         Find paste Return escape        * Initialize find prompt
  380.         getscrbuff "R~~" return cut     * Cut replace text from scratch|2.7
  381.         FindReplace return              * Begin replacement
  382.         paste return                    * paste REPLACEMENT text
  383.        "GIN"                            * Replace options
  384. *       pause                          ** Add this to pause for options
  385.         return                          *   MUST include "GIN"
  386. * ------------------ load files, do search/replace ------------------*
  387.         Begline Cursorright      * Put cursor in Col. 2 of NUL File
  388.         LOOP:                    * Main test loop
  389.             Nextfile             * Move to next files in Ring
  390.             Cursorleft           * Move cursor left (need for NUL test)
  391.             Jfalse DOIT:         * If couldn't move to left, it's not
  392.                                  * the NUL File AND cursor position
  393.                                  * has not changed -- GO with the
  394.                                  * FindReplace
  395.                                  *ELSE
  396.                                  * Check to see if in the NUL File
  397.             Cursorleft           * Move cursor left for NUL Test
  398.             Jfalse ENDLOOP:      * If couldn't move left -- We
  399.                                  * ARE in the NUL File and Need
  400.                                  * to ENDLOOP
  401.                                  *ELSE
  402.             Cursorright          * Move back to Col. 2 in NUL File
  403.         DOIT:                    * FindReplace Loop
  404.             BegFile              * Move up in case cursor is below find
  405.             Repeatfind           * Do the FindReplace
  406.             Jtrue SAVE:          * If CHANGES are made -- SAVE the File
  407.             Quit                 * If NO CHANGES are made -- QUIT the
  408.                                  *  File
  409.             Jump LOOP:           * Return to the Main Loop
  410.         SAVE:                    * Routine to Save a File with Changes
  411.             Savefile             * Save the file
  412.             Jump LOOP:           * Return to Main Loop
  413.         ENDLOOP:                 * Loop is DONE
  414. * -------------------- initialize find for search --------------------*
  415.         getscrbuff "R~~" return  * Get replacement text from scratch   |2.7
  416.         cut                      * Cut replace text from scratch
  417.         Find paste return escape * Initialize Find
  418.         Quit                     * Quit the NUL File
  419.  END:                            *
  420. * ------------------------------ reset ------------------------------*
  421.         EditFile "c:\!" Return   * Load FGREP.COM output as first file
  422.         defaultwordset           * Set default
  423. *
  424. * 153 bytes Tue  10-02-1990  18:50:33
  425. * 223 bytes Thu  04-25-1991  11:57:13 added find initialize for search
  426. *                                     added "GIN" replace option
  427. *                                     added "No found text" message
  428. *                                     changed file "_" to "NUL", faster
  429. *                                     load FGREP.COM output as first file
  430. *                                       after replacement
  431. * 231 bytes Tue  04-30-1991  22:12:13 changed search and replace to scrap
  432.  
  433. * 
  434. *┌─────────────────────────────────────────────────────────┐
  435. *│ @(1) - makes FileList of files containing search text   │
  436. *└─────────────────────────────────────────────────────────┘
  437. @1      MacroBegin
  438.         Dos 'FGREP -f0 /'               * Make FileList                 |2.9
  439.         Pause                           *
  440.         '/>c:! @SRCH-FG.lst'            *
  441.         return return                   *
  442.         editfile "c:!" return quit      * Edit FileList
  443.         editfile return                 *
  444.         begfile                         *
  445.         MarkColumn                      * Mark begfile c:!
  446.         endfile begline                 * Mark endfile col 1
  447.         wordright wordright             * Get to file name
  448.         cursorleft                      * Move off file name
  449.         DeleteBlock                     * Delete file name
  450.         SaveFile                        * Save FileList
  451.         begfile                         * Get to begin
  452.         MarkColumn                      * Mark begfile c:!
  453.         EndFile                         * Get to end
  454.         gotocolumn "12" return          * Get all file names in block
  455.         Sort                            * Sort FileList
  456.         killfile                        * Kill c:!
  457.         begfile                         * See FileList
  458.         unmarkblock                     * Without block mark
  459. *
  460. * 99 bytes Tue  07-02-1991  17:56:32 (TH @1)
  461.  
  462. * 
  463. *┌──────────────────────────────────────────────────────────────┐
  464. *│ @(2) - loads FileList of files containing search text        │
  465. *└──────────────────────────────────────────────────────────────┘
  466. * Written by Kyle Watkins, SemWare.
  467. *
  468. @2      MacroBegin
  469. ***************************************** LOAD FileList (from QLSTxx)
  470.         EndFile BegLine                 * Start at last line
  471.  REPEAT:
  472.         UnmarkBlock MarkLine Copy       * Grab this name
  473.         EditFile                        * Get ready to load
  474.         CurrentFilename " "             * To force return *here*
  475.         Paste Return                    * Paste file name & do it!
  476.         CursorUp                        * More lines above?
  477.         JTrue REPEAT:                   * If yes, repeat.
  478. *
  479. * 19 bytes Mon  09-03-1990  00:56:04
  480.  
  481. * 
  482. * --------------------------------------------------------------------
  483. * @(4) Search/replace from command line, quit each file after rplcmnt.
  484. * --------------------------------------------------------------------
  485. *
  486. * Often the total size of files needing a "replacement" will exceed the
  487. * available memory when using SR.BAT and the startup macro @0. Macro @4
  488. * in SRQ.QM is simply a modification of @0 by replacing savefile with
  489. * file, so each file is quit after replacement. See SRQ.QM for this
  490. * macro.
  491. *
  492. * This macro must be the first macro in the file because it is used as
  493. * the startup macro with SRQ.BAT. IT CANNOT BE RUN WHILE EDITING!
  494.  
  495. * See SRQ.QM for @4.
  496.  
  497. * 
  498. *┌───────────────────────────────────────────────────────────────────┐
  499. *│ @(5) Makes and loads FileList of files containing search text,    │
  500. *│      then search/replace loaded files while editing               │
  501. *└───────────────────────────────────────────────────────────────────┘
  502. *
  503. @5     MacroBegin
  504. ***************************************** GET SEARCH TEXT
  505.         unmarkblock                     *
  506.         Editfile 'NUL' Return             * Insert -or- GoTo NUL File
  507.        "Search Text=" markcolumn pause  * Search text?
  508.         storescrbuff "1" return copy    * Copy search text to scrap
  509. ***************************************** GET REPLACE TEXT
  510.         RETURN                          * Move to next line
  511.        "Replace Text=" markcolumn pause * Replacement text?
  512.         storescrbuff "2" return         * Store replacement to scratch
  513.         quit                            * Quit NUL
  514. ***************************************** MAKE FileList
  515.         DOS 'FGREP -f0 /'               * Make FileList                 |2.9
  516.         paste                           * Paste search text
  517.         '/>c:! @SRCH-FG.lst'            *
  518.         return return                   *
  519.         editfile "c:!" return quit      * Edit FileList
  520.         editfile return                 *
  521.         begfile MarkColumn              * Mark begfile c:!
  522.         endfile begline                 * Mark endfile col 1
  523.  jfalse END:                            * End if no search text found
  524.         wordright wordright             * Get to file name
  525.         cursorleft                      * Move off file name
  526.         DeleteBlock                     * Delete file name
  527.         begfile                         * Get to begin
  528.         MarkColumn                      * Mark begfile c:!
  529.         EndFile                         * Get to end
  530.         gotocolumn "12" return          * Get all file names in block
  531.         Sort                            * Sort FileList
  532. ***************************************** LOAD FileList (from QLSTxx)
  533.         EndFile BegLine                 * Start at last line
  534.  REPEAT:
  535.         UnmarkBlock MarkLine Copy       * Grab this name
  536.         EditFile                        * Get ready to load
  537.         CurrentFilename " "             * To force return *here*
  538.         Paste Return                    * Paste file name & do it!
  539.         CursorUp                        * More lines above?
  540.         JTrue REPEAT:                   * Yes ? repeat
  541.         killfile                        * Kill c:!
  542.         quit                            * Quit c:!
  543.         Editfile 'NUL' Return             * Insert -or- GoTo NUL File
  544.         getscrbuff "1" return cut       * Cut search text from scratch
  545.         Find paste Return escape        * Initialize find prompt
  546.         getscrbuff "2" return cut       * Cut replace text from scratch
  547.         FindReplace return              * Begin replacement
  548. *         paste RETURN                    * paste REPLACEMENT text
  549.          "GIN" Return                    ** Replace, no prompt
  550.         Pause Return                    * Allow user input of Options
  551.         Begline Cursorright      * Put cursor in Col. 2 of NUL File
  552.         LOOP:                    * Main test loop
  553.             Nextfile             * Move to next files in Ring
  554.             Cursorleft           * Move cursor left (need for NUL test)
  555.             Jfalse DOIT:         * If couldn't move to left, it's not
  556.                                  * the NUL File AND cursor position
  557.                                  * has not changed -- GO with the
  558.                                  * FindReplace
  559.                                  *ELSE
  560.                                  * Check to see if in the NUL File
  561.             Cursorleft           * Move cursor left for NUL Test
  562.             Jfalse END:          * If couldn't move left -- We
  563.                                  * ARE in the NUL File and Need
  564.                                  * to END the Macro
  565.                                  *ELSE
  566.             Cursorright          * Move back to Col. 2 in NUL File
  567.         DOIT:                    * FindReplace Loop
  568.             BegFile              * In case cursor is below find
  569.             Repeatfind           * Do the FindReplace
  570.             Jtrue SAVE:          * If CHANGES are made, SAVE the File
  571.             Quit                 * If NO CHANGES are made, QUIT the File
  572.             Jump LOOP:           * Return to the Main Loop
  573.         SAVE:                    * Routine to Save a File with Changes
  574.             Savefile             * Save the file
  575.             Jump LOOP:           * Return to Main Loop
  576.         END:                     * Macro is DONE
  577.             Quit                 * Quit the NUL File
  578. *
  579. * 235 bytes Tue  07-02-1991  17:56:57 (TH @5)
  580. * 243 bytes Tue  08-06-1991  22:27:45 (TH @5, replaced '!' with NUL')
  581. * 248 bytes Tue  08-06-1991  22:39:27 (TH @5, set FindReplace option 'GIN')
  582.  
  583. * 
  584. * ----------------------------------------------------------------------
  585. * @(6) - Srch ONLY from command line, loads files w/sm.bat, no replace
  586. * -------------------- uses MaxFind mf.exe -----------------------------
  587. *
  588. * Files containing a search string from a file pattern are searched,
  589. * found, and loaded for editing or viewing. The search string, file
  590. * pattern, and other input or search options may be specified at the
  591. * command line or entered at the option query prompt. "Fuzzy", "and/or",
  592. * and "sliding window" text searches can be done. Text search program
  593. * is MaxFind.
  594. *
  595. * To run, type "sm" <enter>, and answer the prompts. Press F4 to
  596. * view the search string in each file after finding. Alternatively,
  597. * parameters may be specified at the command line.
  598.  
  599. * See SM.QM for @6.
  600.  
  601. * 
  602. * ┌──────────────────────────────────────────────────────────────────┐
  603. * │ @(7) -Start up macro, loads only found files, no replacement     │
  604. * └──────────────────────────────────────────────────────────────────┘
  605.  
  606. * See SRL.QM for @7.
  607.  
  608. * 
  609. * ------------------------------------------------------------------------
  610. * @(8)  MACRO TO EXECUTE the FindReplace ACROSS the ENTIRE RING OF FILES
  611. *     ----------------------------------------------------------------
  612. *
  613. * See Kyle Watkin's alternate version below for more discussion.
  614.  
  615. @8      Macrobegin
  616.         Editfile 'NUL' Return      * Insert -or- GoTo NUL File
  617.         Findreplace Pause Return * Allow user input of Find Item
  618.         Pause Return             * Allow user input of Replace Item
  619.         "GIN" Return             * Replace all loaded files, no prompt
  620. *         Pause Return             * Allow user input of Options
  621.         Begline Cursorright      * Put cursor in Col. 2 of NUL File
  622.         LOOP:                    * Main test loop
  623.             Nextfile             * Move to next files in Ring
  624.             Cursorleft           * Move cursor left (need for NUL test)
  625.             Jfalse DOIT:         * If couldn't move to left, it's not
  626.                                  * the NUL File AND cursor position
  627.                                  * has not changed -- GO with the
  628.                                  * FindReplace
  629.                                  *ELSE
  630.                                  * Check to see if in the NUL File
  631.             Cursorleft           * Move cursor left for NUL Test
  632.             Jfalse END:          * If couldn't move left -- We
  633.                                  * ARE in the NUL File and Need
  634.                                  * to END the Macro
  635.                                  *ELSE
  636.             Cursorright          * Move back to Col. 2 in NUL File
  637.         DOIT:                    * FindReplace Loop
  638.             Begfile              * Needed in case cursor is below Find
  639.             Repeatfind           * Do the FindReplace
  640.             Jtrue SAVE:          * If CHANGES are made -- SAVE the File
  641.             Quit                 * If NO CHANGES made  -- QUIT the File
  642.             Jump LOOP:           * Return to the Main Loop
  643.         SAVE:                    * Routine to Save a File with Changes
  644.             Savefile             * Save the file with CHANGES
  645.             Jump LOOP:           * Return to Main Loop
  646.         END:                     * Macro is DONE
  647.             Quit                 * Quit the NUL File
  648. *
  649. * 62 bytes Sat  09-15-1990  11:17:57 (K. Watkins version)
  650. * 41 bytes Sun  09-30-1990  20:32:55 (this version)
  651. * 45 bytes Tue  08-06-1991  22:30:19 (TH @8, replaced '!' with 'NUL')
  652. * 50 bytes Tue  08-06-1991  22:37:23 (TH @8, set FindReplace option 'GIN')
  653.  
  654. * * ┌────────────────────────────────────────────────────────────────────┐
  655. * * │@(8)  MACRO TO EXECUTE the FindReplace ACROSS ENTIRE RING OF FILES  │
  656. * * └────────────────────────────────────────────────────────────────────┘
  657. * *
  658. * * the following macro was written by Kyle Watkins of SemWare in
  659. * * response to my request for a macro to search/replace all loaded
  660. * * files, but also:
  661. * *         - save to disk only those files that had a replacement, and
  662. * *         - keep loaded  only those files that had a replacement made.
  663. * * It is an excellent and creative macro which I urge you to study
  664. * * because of the unique and powerful use of a NUL file as a
  665. * * place-marker.
  666. *
  667. * * ==========================================================================
  668. * * Date: 09-14-90 (11:49)           Number: 9940         SemWare Support BBS
  669. * *   To: TOM HOGSHEAD               Refer#: NONE
  670. * * From: KYLE WATKINS                 Read: NO
  671. * * Subj: ONCE AROUND the FILE-RING    Conf: (0) Main Board
  672. * * ------------------------------------------------------------------------
  673. * * TH>I have been trying for several months to either modify the following
  674. * * TH>macro or come up with another way to search & replace all loaded
  675. * * TH>files but also to:
  676. * * TH>
  677. * * TH>        - save to disk only those files that had a replacement, and
  678. * * TH>        - keep loaded  only those files that had a replacement made.
  679. * *
  680. * * Hi Tom,
  681. * *     You may need to adjust this macro at the point where I quit the file
  682. * * if no replacements were made to it (the macro can be adjusted to save
  683. * * those files, if there were some pre-existing changes that were present
  684. * * before the macro was envolked). I wasn't sure what you wanted (my own
  685. * * preference is to retain other changes that I made before I envolked this
  686. * * macro -- BUT I wrote the macro to just Quit those files, since that is
  687. * * what I am guessing you want).
  688. * *     Basically, the macro will use the NUL file as a placeholder in the
  689. * * Ring-of-Files. With cursor manipulation, I will determine when you
  690. * * arrive at the NUL file again. Once you get back to the NUL file, the
  691. * * macro will end. Your starting point for the FindReplace throughout the
  692. * * entire Ring will be at the file immediately after the NUL file -- So if
  693. * * you do not have a NUL file already loaded, the starting point will be at
  694. * * the next file from the one that you are currently in. Otherwise, the
  695. * * starting point will be at the next file from the present location of the
  696. * * NUL file.
  697. * *     Note that I always return to the original cursor position, before
  698. * * the FindReplace is executed (allowing you to select any Option for the
  699. * * FindReplace routine).
  700. * *
  701. *
  702. * * ------------------------------------------------------------------------
  703. * *     MACRO TO EXECUTE the FindReplace ACROSS the ENTIRE RING OF FILES
  704. * *     ----------------------------------------------------------------
  705. * *
  706. * @8      Macrobegin
  707. *         Editfile 'NUL' Return    * Insert -or- GoTo NUL File
  708. *         Findreplace Pause Return * Allow user input of Find Item
  709. *         Pause Return             * Allow user input of Replace Item
  710. *         Pause Return             * Allow user input of Options
  711. *         Begline Cursorright      * Put cursor in Col. 2 of NUL File
  712. *                                  *
  713. *         LOOP:                    * Main test loop
  714. *                                  *
  715. *             Nextfile             * Move to next files in Ring
  716. *             Cursorleft           * Move cursor left (need for NUL test)
  717. *             Jfalse DOIT:         * If couldn't move to left, it's not
  718. *                                  * the NUL File AND cursor position
  719. *                                  * has not changed -- GO with the
  720. *                                  * FindReplace
  721. *                                  *
  722. *                                  *ELSE
  723. *                                  * Check to see if in the NUL File
  724. *                                  *
  725. *             Editfile
  726. *             'NUL ' Currentfilename Return * GoTo NUL File -- AND--
  727. *                                           * Preload File to Edit
  728. *                                           * Buffer so can Return
  729. *                                           * to Current File
  730. *                                  *
  731. *             Cursorleft           * Move cursor left for NUL Test
  732. *             Jfalse END:          * If couldn't move left -- We
  733. *                                  * ARE in the NUL File and Need
  734. *                                  * to END the Macro
  735. *                                  *
  736. *                                  *ELSE
  737. *             Cursorright          * Move back to Col. 2 in NUL File
  738. *                                  *
  739. *             Editfile
  740. *             Begline Delch Delch Delch Return  * Bring up EditFile Prompt
  741. *                                               * and delete NUL and
  742. *                                               * Return to File we left
  743. *                                  *
  744. *             Cursorright          * Restore Cursor to its previous
  745. *                                  * position and GO with the FindReplace
  746. *                                  *
  747. *         DOIT:                    * FindReplace Loop
  748. *                                  *
  749. *             Repeatfind           * Do the FindReplace
  750. *             Jtrue SAVE:          * If CHANGES are made -- SAVE the File
  751. *                                  *
  752. *             Quit                 * If NO CHANGES are made -- QUIT the
  753. *                                  * File
  754. *                                  *
  755. *             Jump LOOP:           * Return to the Main Loop
  756. *                                  *
  757. *                                  *
  758. *         SAVE:                    * Routine to Save a File with Changes
  759. *                                  *
  760. *             Savefile             * Save the file
  761. *             Jump LOOP:           * Return to Main Loop
  762. *                                  *
  763. *         END:                     * Macro is DONE
  764. *                                  *
  765. *             Quit                 * Quit the NUL File
  766. * *
  767. * * 62 bytes Sat  09-15-1990  11:17:57 (added TH)
  768. *
  769. *
  770. * *      ----------------------------------------------------------------
  771. * *     I hope this is what you need Tom. Feel free to optimize and alter
  772. * * the macro. The main Body of this macro can be used to allow any kind of
  773. * * ONE-TIME File Ring Sweep. I have already used the main body of the macro
  774. * * (with the necessary adjustments) to Load all files that DO NOT cause a
  775. * * PRESS ESCAPE message -- So I hope it proves useful to you.
  776. * *
  777. * *                              --... ...--
  778. * * .......Kyle Watkins (SemWare Technical Support)
  779.  
  780.  
  781. * 
  782. * ----------------------------------------------------------------------
  783. * @(9) Search Only, Keep Loaded Only Files With "Found" Text
  784. * ----------------------------------------------------------------------
  785.  
  786.  
  787. * This macro uses the same technique developed by Kyle Watkins in @8,
  788. * to keep loaded ONLY files with "found" text. No replacement or save
  789. * is made (@8 makes replacement and saves files with replacements, but
  790. * files without any replacement are QUIT from ring).
  791. *
  792. * Version 1.6 of this macro used RepeatFind in the DOIT loop. If that
  793. * version was executed more than once and the cursor was on the last
  794. * occurrence of the search text in a file, RepeatFind would NOT find the
  795. * search text again, and the file was QUIT from the ring. Apparently
  796. * RepeatFind does NOT remember the "G" option with Find.
  797. *
  798. * This version replaces RepeatFind with Find "G". Now, if @9 is executed
  799. * more than once, any file with any occurrence of the search text is
  800. * correctly kept loaded.
  801. *
  802. @9      Macrobegin
  803.         Editfile 'NUL' Return      * Insert -or- GoTo NUL File
  804.         Find Pause Return "G"    * Allow user input of Find Item
  805.         Pause Return             * Allow user input of Options
  806.         Begline Cursorright      * Put cursor in Col. 2 of NUL File
  807.         LOOP:                    * Main test loop
  808.             Nextfile             * Move to next files in Ring
  809.             Cursorleft           * Move cursor left (need for NUL test)
  810.             Jfalse DOIT:         * If couldn't move to left, it's not
  811.                                  * the NUL File AND cursor position
  812.                                  * has not changed -- GO with the
  813.                                  * FindReplace
  814.                                  *ELSE
  815.                                  * Check to see if in the NUL File
  816.             Cursorleft           * Move cursor left for NUL Test
  817.             Jfalse END:          * If couldn't move left -- We
  818.                                  * ARE in the NUL File and Need
  819.                                  * to END the Macro
  820.                                  *ELSE
  821.             Cursorright          * Move back to Col. 2 in NUL File
  822.         DOIT:                    * Find Loop
  823.             Find Return "G" return * Do the Find
  824.             Jtrue LOOP:          * If FOUND   -- Return to Main Loop
  825.             Quit                 * If NO FIND -- QUIT the file
  826.             Jump LOOP:           * Return to the Main Loop
  827.         END:                     * Macro is DONE
  828.             Quit                 * Quit the NUL File
  829. *
  830. * 40 bytes Sun  09-30-1990  22:48:24
  831. * 44 bytes Tue  08-06-1991  22:31:06 (TH @9, replaced '!' with 'NUL')
  832.  
  833. * ^f1 and ^f2 macros are modifications to macros written by Tim Farley
  834. * in BIGFIND.QM dated 8/21/89 and revised 9/6/89.
  835. * 
  836. *------------------------------------------------------------
  837. * ^(f1_) Find multiple search text in current file, uses FGREP.COM
  838. *------------------------------------------------------------
  839. *
  840. * Find all instances of a given string in current file, let the user
  841. * select one, hit return, and view line containing search string.
  842. * Change "c:" to ramdrive for faster operation.
  843. *
  844. * Uses Chris Dunford's excellent FGREP.COM. Remember search string is
  845. * NOT case sensitive.
  846. *
  847. ^f1     MacroBegin                      *
  848.         UnmarkBlock DropAnchor          * Mark current file to return to
  849.                                         * later
  850.         EditFile "c:!" Return Quit      * Quit temp file if loaded
  851.                                         * Sets EditFile prompt for later
  852.         GotoBlockBeg                    * Return to where we were
  853.         UnmarkBlock                     * Unmark
  854.         DOS 'FGREP -L /'                * Prompt for search text        |2.9
  855.         Pause                           *
  856.         '/>c:! '                        * Echo output to temp file
  857.         CurrentFilename Return Return   * Search current file
  858.         EditFile Return                 * Load temp file with found text
  859.         Pause                           * Pause to select line to view
  860.         BegLine WordRight MarkWord      * Mark found text line number
  861.         Copy                            * Copy line number to scrap
  862.         KillFile                        * Delete temp file from disk
  863.         PrevFile                        * Return to searched file
  864.         GotoLine Paste Return           * View found text line
  865.         MakeCtrOfScreen                 * Put on screen center
  866. *
  867. * 67 bytes Tue  07-02-1991  17:57:22 (TH ^f1)
  868.  
  869. * 
  870. *---------------------------------------------------------------
  871. * ^(f2_) Find multiple search text in current file, uses Dos FIND
  872. *---------------------------------------------------------------
  873. *
  874. * Find all instances of a given string in current file, let the user
  875. * select one, hit return, and view line containing search string.
  876. * Change "c:" to ramdrive for faster operation.
  877. *
  878. * Uses Dos FIND. Remember search string is case sensitive.
  879. *
  880. ^f2     MacroBegin                      *
  881.         UnmarkBlock DropAnchor          * Mark current file to return to
  882.                                         * later
  883.         EditFile "c:!" Return Quit      * Quit temp file if loaded
  884.                                         * Sets EditFile prompt for later
  885.         GotoBlockBeg                    * Return to where we were
  886.         UnmarkBlock                     * Unmark
  887.         Dos 'FIND /N "'                 * Prompt for search text
  888.         Pause '" '                      *
  889.         CurrentFilename                 * Search current file
  890.         '>c:!' Return Return            * Echo output to temp file
  891.         EditFile Return                 * Load temp file with found text
  892.         Pause                           * Pause to select line to view
  893.         BegLine WordRight MarkWord      * Mark found text line number
  894.         Copy                            * Copy line number to scrap
  895.         KillFile                        * Delete temp file from disk
  896.         PrevFile                        * Return to searched file
  897.         GotoLine Paste Return           * View found text line
  898.         MakeCtrOfScreen                 * Put on screen center
  899. *
  900. * 65 bytes Sat  02-16-1991  02:55:59
  901.  
  902. * 
  903. *-------------------------------------------------------------
  904. * ^(f3_) View another occurrence of search text in current file
  905. *-------------------------------------------------------------
  906. * Position cursor on line to view another occurrence of search text in
  907. * current file, and hit <enter>. Works only after running either
  908. * ^f1 or ^f2.
  909. *
  910. ^f3 MacroBegin                          *
  911.     onewindow                           * Close all windows
  912.     horizontalwindow zoomwindow         * Open window full, current file
  913.     editfile "c:!" return               * Load temp file with found text
  914.     begline                             * Re-position cursor
  915.     pause                               * Pause to select line to view
  916.     wordright markword copy             * Mark line #, copy to scrap
  917.     zoomwindow                          * Zoom temp file window small
  918.     prevwindow                          * Back to orig file window
  919.     begline                             * Re-position cursor
  920.     gotoline paste return               * Goto found text line
  921. *   pause                               * Pause to see temp file
  922.     zoomwindow                          * Zoom orig window full
  923. *
  924. * 27 bytes Mon  02-18-1991  00:31:32
  925.  
  926. * 
  927. *┌───────────────────────────────────────────────────────────────────┐
  928. *│@(h) Finds first word on cursor line marked in document below      │
  929. *└───────────────────────────────────────────────────────────────────┘
  930. *
  931. *        @h macro has 2 steps:
  932. *
  933. *        1. Press @ and h at the same time. An ! shows at the
  934. *        end of the top line. Cursor down to desired line in Index.
  935. *
  936. *        2. Press Enter. The macro first erases the !, and
  937. *        then finds the first word on the cursor line in the document
  938. *        below marked with (...).
  939. *
  940. * See BOOKxx.QM for more details.
  941. *
  942. @h macrobegin
  943.         unmarkblock                     * Unmark any marked blocks
  944.         defaultwordset                  * In case altwordset on
  945.         begfile                         *
  946.         endpara                         * Move to end of Index
  947.         markline                        * Mark it
  948.         begfile                         * Move to bof
  949.         find "(" return "L" return      * Locate first Index selection line
  950.     jfalse NOMARK:                      *
  951.         makectrofscreen                 * Show top of file
  952.         begfile                         * Move back to bof
  953.         unmarkblock markline markline   * And highlight line 1
  954.         prevposition                    * Move back to first selection line
  955.         begline                         * Cursor in col 1
  956.         pause                           * Pause for Index selection
  957.         wordright markword              * Mark first word on line
  958.         copy                            * Copy word to scrap
  959.         endpara                         * Go to end of Index
  960.         find "(" paste ")"              *
  961.         return "I" return               * Find first marked word in doc
  962.     jfalse NOMARK:                      *
  963.         begline                         * If mark found go to begline
  964.         maketopofscreen scrollup        * Cursor on line 2                |a
  965.     jump END:                           *
  966.     NOMARK:                             *
  967.         begfile                         * If no mark found go to begfile
  968.     END:
  969. *
  970. * 34 bytes Sun  07-28-1991  15:48:33 (TH @1)
  971. * 52 bytes Wed  07-31-1991  14:43:31 (TH @h, @4 in BOOKxx.QM)
  972.  
  973.  
  974. * =========================================================================
  975. * Date: 10-29-90 (13:26)           Number: 3156         SemWare Support BBS
  976. *   To: EDGAR ESTRADA              Refer#: 3155
  977. * From: TIM FARLEY                   Read: YES
  978. * Subj: Qedit                        Conf: (21) ILink
  979. * ------------------------------------------------------------------------
  980. * EE>I'm interested in finding out how to get Qedit to wordwrap while using
  981. * EE>the right cursor key.
  982. *
  983. * You mean like WordStar does, where it won't let the cursor move
  984. * out into the "empty space" to the right of the lines?
  985. *
  986. * Here are some macros to do this in 2.1:
  987. *
  988. * *
  989. * * Left and Right cursor definitions that wrap to previous/next
  990. * *                line like WordStar does
  991. * *
  992. *-------------------------------------
  993. * (CursorLeft) Macro   (line added TH)
  994. *-------------------------------------
  995. *
  996. * cursorleft    MacroBegin
  997. *               CursorLeft     * try to go left
  998. *               JTrue end:     * succeed!  then we are done
  999. *               CursorUp       * else try to go to prev line
  1000. *               JFalse end:    * if fail, then at top of file. done.
  1001. *               EndLine        * jump to end of previous line.
  1002. *             end:
  1003. *
  1004. * 13 bytes Mon  10-29-1990  19:33:07 (line added TH)
  1005.  
  1006. * 
  1007. *-------------------------------------
  1008. * (CursorRight) Macro  (line added TH)
  1009. *-------------------------------------
  1010. *
  1011. * cursorright   MacroBegin
  1012. *               EndLine        * are we at end of line?
  1013. *               JFalse down:
  1014. *               PrevPosition   * back to where we were
  1015. *               CursorRight    * and right one
  1016. *               Jump end:
  1017. *             down:
  1018. *               CursorDown     * try to go to next line
  1019. *               JFalse end:
  1020. *               BegLine
  1021. *             end:
  1022. *
  1023. * 18 bytes Mon  10-29-1990  19:32:57 (line added TH)
  1024.  
  1025. * NOTE:  You must have the latest registered release of QEdit 2.1
  1026. *        to use these macros.  Otherwise you will experience odd
  1027. *        side-effects in the menus and other special contexts where
  1028. *        the arrow keys have meaning.
  1029. *
  1030. * there will be an easier way to achieve this behavior in the next
  1031. * release of QEdit.
  1032. *
  1033. * --Tim Farley
  1034. *   SemWare Technical Support
  1035.  
  1036. *------------ (Single line macros for QCONFIG.DAT) ----------------
  1037.  
  1038. * cursorleft MacroBegin CursorLeft JTrue Label0: CursorUp JFalse Label1: EndLine Label0: Label1:
  1039.  
  1040. * cursorright MacroBegin EndLine JFalse Label0: PrevPosition CursorRight Jump Label1: Label0: CursorDown JFalse Label2: BegLine Label1: Label2:
  1041.  
  1042. * Here are four macros that are variations of wordleft and wordright.
  1043. * Macros @a and @f position the cursor on the first word delimiter
  1044. * after wordleft and wordright. The cursor position will be the space
  1045. * following the word as long as no other word delimiter like "," and
  1046. * *"." etc immediately follows the word. Macros @a and @f unmark any
  1047. * previously marked block, but I don't know any other way to keep this
  1048. * from happening. Macros ^a and ^f do almost what wordleft and
  1049. * wordright do except the cursor does not stop at the end of a line.
  1050. *
  1051. *          @a Moves cursor to first word delimiter after wordleft
  1052. *          @f Moves cursor to first word delimiter after wordright
  1053. *          ^a Moves cursor to first character of wordleft
  1054. *          ^f Moves cursor to first character of wordright
  1055.  
  1056. * 
  1057. *┌──────────────────────────────────────────────────────────────┐
  1058. *│@(a) Moves cursor to first word delimiter after wordleft      │
  1059. *└──────────────────────────────────────────────────────────────┘
  1060. @a  macrobegin                          *
  1061.     wordleft wordleft                   * Move wordleft twice
  1062.     endline                             * Test if on eol
  1063.  jtrue NO_EOL:                          * If not on eol, tests true
  1064.     wordleft                            * If on eol, goto wordleft
  1065.     jump GOTOPOS:                       * Go to end of word
  1066.  NO_EOL: prevposition                   * If not at eol, return
  1067.  GOTOPOS:                               * to where we were
  1068.     markword gotoblockend unmarkblock   * Get to end of word
  1069. *
  1070. * 18 bytes Mon  10-22-1990  11:32:21
  1071.  
  1072. * 
  1073. *┌─────────────────────────────────────────────────────────────┐
  1074. *│@(f) Moves cursor to first word delimiter after wordright    │
  1075. *└─────────────────────────────────────────────────────────────┘
  1076. @f  macrobegin                          *
  1077.     wordright                           * Move wordright
  1078.     endline                             * Test if on eol
  1079.  jtrue NO_EOL:                          * If not on eol, tests true
  1080.     wordright                           * If on eol, goto wordright
  1081.     jump GOTOPOS:                       * Go to end of word
  1082.  NO_EOL: prevposition                   * If not at eol, return to
  1083.  GOTOPOS:                               * where we were
  1084.     markword gotoblockend unmarkblock   * Get to end of word
  1085. *
  1086. * 17 bytes Mon  10-22-1990  11:32:32
  1087.  
  1088. * 
  1089. *┌─────────────────────────────────────────────────────────────┐
  1090. *│^(a_) Moves cursor to first character of wordleft            │
  1091. *└─────────────────────────────────────────────────────────────┘
  1092. ^a  macrobegin                          *
  1093.     wordleft                            * Move wordleft
  1094.     endline                             * Test if on eol
  1095.  jtrue NO_EOL:                          * If not on eol, tests true
  1096.     wordleft                            * If on eol, goto wordleft
  1097.     jump GOTOPOS:                       * End macro
  1098.  NO_EOL: prevposition                   * If not at eol, return to
  1099.  GOTOPOS:                               * where we were
  1100. *
  1101. * 14 bytes Mon  10-22-1990  11:53:14
  1102.  
  1103. * 
  1104. *┌─────────────────────────────────────────────────────────┐
  1105. *│^(f_) Moves cursor to first character of wordright       │
  1106. *└─────────────────────────────────────────────────────────┘
  1107. ^f macrobegin                           *
  1108.     wordright                           * Move wordright
  1109.     endline                             * Test if on eol
  1110.  jtrue NO_EOL:                          * If not on eol, tests true
  1111.     wordright                           * If on eol, goto wordright
  1112.     jump GOTOPOS:                       * End macro
  1113.  NO_EOL: prevposition                   * If not at eol, return to
  1114.  GOTOPOS:                               * where we were
  1115. *
  1116. * 14 bytes Mon  10-22-1990  11:53:03
  1117.  
  1118.  
  1119. * (F4)
  1120. f4      RepeatFind
  1121.  
  1122. * (F5)
  1123. f5      PrevFile
  1124.  
  1125. * (F6)
  1126. f6      NextFile
  1127.  
  1128. * (VERSION) HISTORY:
  1129. *
  1130. *    1.0a - Corrected @5 to use @SRCH-FG.lst, not SRCH.lst.
  1131. *    1.0b - Modified to not use optional batch file.
  1132. *         - Removed @5.
  1133. *    1.0c - Added Alt_0 for search/replace from command line.
  1134. *         - Modified SRC.BAT, @1 & @4 for case sensitive search.
  1135. *         - Modified @4 to re-load search files after replacement.
  1136. *         - Corrected @1 byte size.
  1137. *    1.0d - Removed redundant lines from @0, shortened 31 bytes
  1138. *         - added START-SR.BAT for quick start.
  1139. *         - Changed c:srch.ql to c:$.qm in macros and batch files.
  1140. *           so as to not overwrite qsrch.ql supplied in SRCHxx.ZIP.
  1141. *         - Added killfile c:$.ql to @1 and @4.
  1142. *         - Changed FC0 to fc0 in macros and batch files for better
  1143. *         - visibility.
  1144. *    1.0e - Added @5 for prompted replacement from command line
  1145. *         - Added @6 for prompted replacement while editing
  1146. *         - Added F4/F6 repeatfind/nextfile
  1147. *         - Modified @4 for single search/replacement text input.
  1148. *    1.0f - Modified SR.BAT and SRC.BAT
  1149. *    1.0g - Modified SR.BAT, SRC.BAT and START-SR.BAT.
  1150. *         - Removed INPUT.COM and INPUT.DOC pending author
  1151. *           permission to include.
  1152. *    1.0h - Removed SRC.BAT, Modified all macros and batch files for
  1153. *           Case insensitive search
  1154. *         - Added @7 and SRL.BAT to only load files with search text,
  1155. *           no replacement
  1156. *         - Modified SR.BAT to load SRCHxx.MAC on start up.
  1157. *    1.0i - Modified @3 to re-load files after replacement.
  1158. *         - Modified all macros and batch files for case insensitive
  1159. *           search, some had not been changed in v1.0h.
  1160. *         - Corrected some macro byte sizes
  1161. *    1.0j - Modified comments in SR.BAT, SRL.BAT
  1162. *         - Modified @7 to about half the size and twice the speed.
  1163. *         - Included a PCED synonym to search/load files with @7.
  1164. *    1.1  - Corrected @7 macro size
  1165. *         - Removed savefile from old @0
  1166. *         - Modified @0 to load FGREP.COM found text, after replacement.
  1167. *         - Added [copy c:$.ql c:!] to SR.BAT
  1168. *         - Changed FGREP.COM "-f0" to "-f" in SR.BAT, loads found text
  1169. *         - Removed @5, same thing can be done with @1/2 and
  1170. *           manual search/replace.
  1171. *         - Modified srch.ql load filelist for quicker file loading.
  1172. *    1.2  - Changed "c:$.ql" to "c:!" in macros @1/4/6, shortened
  1173. *           each macro 12 bytes.
  1174. *    1.3  - Modified @3 to be smaller and faster.
  1175. *    1.4  - Changed "*F" to #42 "Fi" in @0 and @7 to be able to load
  1176. *           this file and SRL.QM with SR and SRL.
  1177. *         - Modified SRL.BAT to accept SRL [search text] from command
  1178. *           as long as [search text] is a SINGLE word.
  1179. *         - Added altwordset to @0 and @7 to correctly load file names
  1180. *           containing the Altwordset characters.
  1181. *         - Changed .lst and .ql files.
  1182. *    1.5  - Removed E:\up from SR.BAT & SRL.BAT
  1183. *    1.6  - Added @8 and @9, modified SR.BAT and SRL.BAT.
  1184. *         - @3 was deleting first character in loaded files,
  1185. *           corrected.
  1186. *    1.7  - Added @h to help locate items or macros from Index.
  1187. *         - Added @5.
  1188. *         - Removed @3, same thing is done better by @8.
  1189. *         - Removed @4 and @6, same thing is done better with @5.
  1190. *         - Modified @0 to use the "Once-Around the ring"
  1191. *           technique developed by Kyle Watkins of SemWare.
  1192. *         - Modified SR.BAT and SRL.BAT.
  1193. *    1.8  - Replaced RepeatFind w/ Find "G" in @9.
  1194. *         - Modified SR.BAT and SRL.BAT.
  1195. *    1.9  - Changed Find initialization in @5 and @0.
  1196. *         - Modified START-SR.BAT for no search/replace text.
  1197. *         - Modified @5, @8, @9 and @0 to be shorter and faster.
  1198. *         - Moved SET >c:$ from @0 macro to SR.BAT batch file.
  1199. *    2.0  - Added @a, @f, ^a, ^f variations of wordleft & wordright.
  1200. *         - Changed quick start file from START-SR to START.
  1201. *    2.1  - Added new key definitions for CursorLeft and CursorRight
  1202. *           to wrap cursor to previous/next line like Wordstar does.
  1203. *         - Changed SEARCH file names to SRCH.
  1204. *    2.1a - Corrected Index Use instructions.
  1205. *    2.2  - Modified @7 (SRL.QM) to highlight first occurrence of
  1206. *           search text.
  1207. *         - Modified SR.BAT and SRL.BAT to search all files in current
  1208. *           directory if SRCH-FG.LST does NOT exist in directory.
  1209. *         - Changed FGREP.COM search target delimiter from " to / in order
  1210. *           to find strings with " (@1, @5, SR.BAT, SRL.BAT).
  1211. *         - Added F5 - PrevFile.
  1212. *         - Added ^f1 & ^f2 to find multiple search text in current file
  1213. *           using FGREP.COM or Dos FIND. Original macros by Tim Farley.
  1214. *    2.3  - Added ^f3 to view another occurrence of search text found
  1215. *           with either ^f1 or ^f2.
  1216. *    2.4  - Added @4 in SRQ.QM to quit each file after replacement
  1217. *           using SRQ.BAT. Quits file after replacement.
  1218. *    2.5  - Removed /LSRCHxx.mac from sr.bat and srl.bat.
  1219. *         - Removed /LSRQ.mac from srq.bat.
  1220. *    2.6  - Added @6 for "fuzzy" & and/or MaxFind searches from command line.
  1221. *         - Added "No found text" message to @0_4_7.
  1222. *         - Added find initialize for search to @0 and @7.
  1223. *         - Added "GIN" automatic replace option to @0 and @4.
  1224. *         - Changed @0 to load FGREP.COM output as first file after replacement.
  1225. *         - Added FGREP.COM "-l" line # option to sr.bat, srl.bat and srq.bat.
  1226. *         - Added /LSRxxxx.mac to sr.bat and srl.bat for F4_6 operation.
  1227. *         - Added /LSRQ.mac to srq.bat for F4_6 operation.
  1228. *         - Changed test.qm name to srch.tst
  1229. *         - Modified SR.BAT, SRL.BAT, SRQ.BAT and SM.BAT.
  1230. *         - Changed SRCH_Q name to SRQ.
  1231. *    2.7  - Changed GOTO 2b to 6a in SR.BAT and SRQ.BAT to stop
  1232. *           batch file when no file list is entered at query prompt.
  1233. *         - Changed FGS to S~~ and FGR to R~~ in @0, 4, 6 and 7.
  1234. *         - Added SZ.BAT and SZR.BAT to search/replace within ZIP files.
  1235. *         - Changed search and replace to scrap routine in @0 and @4.
  1236. *         - Changed initialize find routine in @7.
  1237. *         - Changed all batch file formats.
  1238. *    2.8  - Added discussion of environment variable to this file.
  1239. *         - Added environment variable SRMAC to batch files.
  1240. *         - Modified batch files for user option to set environment
  1241. *           variable FILELIST for different file lists. All batch files
  1242. *           can now be run from any directory.
  1243. *    2.9  - Added environment variable SZTEMP to SZ.BAT and SZR.BAT.
  1244. *         - Removed unnecessary "com" extension from fgrep.com that
  1245. *          "snuck" into  @1, @5, and ^F1.
  1246. *         - Changed "c:$.ql" to "c:\$.ql" in SRL.BAT.
  1247. *    2.9a - Corrected Index. Included in AMAC39.ZIP, July 21, 1991.
  1248. *    2.9b - Changed documentation.
  1249. *         - Added latest version of @h.                                 8/2/91
  1250. *                     (Included v2.9b in AMACxx v4.0)
  1251. *    3.0  - Changed file name in @5, @8 and @9 from '!' to 'NUL'.       8/6/91
  1252. *         - Changed FindReplace option to "GIN" in @5 and @8.           8/6/91
  1253. *         - File name changed in SR.BAT and SZR.BAT in version change.  8/6/91
  1254. *         - Added instructions to do case sensitive search/replace.     8/9/91
  1255. *         - Removed dummy.zip from test.zip.                           8/11/91
  1256. *
  1257. *
  1258. *
  1259. *
  1260. *
  1261. *
  1262.