home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
editors
/
amac41.arj
/
SM.QM
< prev
next >
Wrap
Text File
|
1991-08-26
|
22KB
|
470 lines
* SM.QM ver N 8/26/91
* Written by Tom Hogshead
* ┌────────────────────────────── (Index) ─────────────────────────────┐
* │
* │ @(6) Search from command line, load files w/search text,
* │ **** MUST use SM.BAT ****
* │
* │ (f4) Finds search text in file after loading
* │
* │ (f5) PrevFile
* │
* │ (f6) NextFile
* │
* │ @(h) Finds first word on cursor line marked in document below
* │
* │ (Description)
* │ (Syntax)
* │ (Mode)
* │ (Required)
* │ (Options) - MaxFind
* │ (NOTE)
* │ (Examples)
* │ (Index) use with @h
* │ (MaxFind) description
* │ (PCED) synonymns to search from a file list
* │ (Other) macros:
* │ (ENVIRONMENT) Variables - See SRCHxx.QM for discussion |K
* │ (REQUIRED) PROGRAM FILES
* │ (CAUTION) ***********
* │ (Version) history
* └────────────────────────────────────────────────────────────────────┘
* (DESCRIPTION):
*
* SM.QM are QEdit macros to search files containing a search string using
* MaxFind. Files are searched, found, and loaded for editing or viewing.
* The search string, file names, and other input or search options may be
* specified at the command line or entered at the option query prompt.
* "Fuzzy", "and/or", and "sliding window" text searches can be done.
*
* To run, type "sm" <enter>, and answer the prompts. Press F4 to
* view the search string in each file after finding. Alternatively,
* parameters may be specified at the command line.
* 1) SYNTAX: SM.BAT %1 %2 %3
* ┌──────────┘ │ └───────────┐
* (Mode) %1 %2 %3
* Search Text File Name Option
* ---------------- ------------- ---------- -------
* a) Query <------- all inputs at prompts ------->
* b) Partial Query Search Text [ ] [ ]
* c) Partial Query Search Text [ ] default
* d) Command line Search Text File Name default
* e) All command line Search Text File Name [ ]
*
* where: %1 - Search Text
* %2 - File Name, wild cards OK
* %3 - MAXFIND options entered without minus
* [ ] - entered at query prompt
* 2) Requires MAXFIND MF.EXE and INPUT.COM
* 3) File Name wild cards OK.
* 4) MAXFIND options can be input at option prompt or %3, default option "ltn"
* 5) Set environment variable OPT=off to bypass MAXFIND option query prompt
*
* MAXFIND (OPTIONS):
*
* MaxFind. Version 2.3 Copyright 1988,90 by Stan Peters
* Shareware, $15. Box 2028, Fairfield, Iowa 94306
* Usage: mf [-options] string [string].... filename [-options]
* Filename may contain ? and *, it may have a path prefix
* You may have 1 to 15 strings.
* A tilde (~) in a string matches any character.
* Options must start with a '- ', they may be first and/or last.
* Searching options:
* a - 'and', all must be present. f - "fuzzy", approximate spelling.
* c - case sensitive search. w - match only if a word.
* d - Span entire document, if necessary.
* Output options:
* l - show line numbers. (*) t - to screen and > file. (*)
* m - stop after first match. (*) u - Unix (grep) style output.(*)
* n - no pause each 24 lines. (*)
* Input options:
* b - also search binary files. s - also include subdirectorys
* h - strip hi (8) bits.
* AND searches using "sliding windows":
* 2 - 15 Window size (number of lines) for searching and displaying
*
* afcwdbsh/ - OK with SM
*
* A / indicates an OR within an AND, use // to find / .
* Example: Find Tom or Bob Jones from Texas in my address file
* Enter: "mf tom/bob jones texas address.fil -a4"
*
* (*) - do not use with sm.bat, "ntl" are default options with sm.bat
* (NOTE):
* - @6 must be the first macro in this file to be used with sm.bat.
* - To use this macro in any directory, change /Esm.mac and
* /Lsm.mac in sm.bat to the location of sm.mac, eg change to
* /Ee:\up\sm.mac.
* - Enter other search or input options as %3 or at the option,
* prompt, eg "c" for case sensitive search without the minus.
* - Search is case insensitive unless option "c" is specified.
* - If no files are found containing the search text, a message
* "No text found" is displayed.
* - Macro will stop before completion if any line containing the
* search text also contains "g>". Macro cannot search for "g>".
* - This macro can be quite "noisy" if beeps are set on with
* QCONFIG, especially if there are many lines containing
* search text. We use "Find" to check each line of the output
* to determine whether it is a file name or found text. File
* names are not quite as "noisy". Testing this macro has forced
* me to set QEdit beeps "off"!
* - A minimum of of 55 bytes free environment space is needed to
* search for a 10 character string with 12 character file spec
* and 1 character option. I suggest you have at least a 100
* bytes free to be safe. Since the free environment space is
* considerably reduced when "shelling to DOS", sm.bat may not
* work properly when "shelled" from another program.
* - MaxFind writes to disk at least once for every file it
* searches. Therefore, for faster macro operation, replace c:\
* in sm.bat and sm.qm with your ram drive.
* (EXAMPLES):
* a) Example: Load all files with extension "bat" or "tst"
* containing "aaa" and "bbb" in each file.
* (Must be run from input mode because of %1 %2 %3 defs.)
* Enter: "sm" <enter>, and at the query prompts enter...
* Search text =aaa bbb
* File name(s) =*.??t
* Option(s) =
*
* b) Example: Load all files with extension "tst" containing "ccc"
* Enter: "sm ccc *.tst" <enter>
* c) Example: Load all files containing "ddd" and "eee" only
* within a 2 line window in each file, with extension
* "tst".
* (Must be run from input mode because of %1 %2 %3 defs.)
* Enter: "sm" <enter>, and at the query prompts enter...
* Search text =ddd eee
* File name(s) =*.tst
* Option(s) =a2
* (sm.tst is included to test above examples)
* (INDEX) USE:
* To locate a macro or item in this file, press @h, place the cursor
* line on the desired item in the Index above, and press <enter>.
* See BOOKxx.QM for more details.
* (MAXFIND) DESCRIPTION (extracted from MaxFind.doc):
* Basically, this program works much like other FIND programs
* that you may have used. Enter the program name at the DOS
* prompt, followed by a string, and then the file name. But
* there are several powerful advantages:
* - Search for up to 15 strings on one pass over the file with
* little performance penalty.
* - Combination and/or searches are definable in an easy to use way.
* - Will search subdirectories or the entire disk.
* - Has a "fuzzy" search, spelling need not be exact.
* - A help screen is available, enter mf <ENTER> at the DOS prompt.
* - It works quickly! Now, with Version 2.3, simple searches on
* my 8 mHz AT disk scan at 100 thousand bytes per second.
* It moves at 70k bytes per second for quite complex searches.
* - A scan window size option for matching and display. Great for
* Name and Address lists and for finding phrases or quotes that
* span more than one line.
* - It is useful on word processors documents and data bases that
* keep their data in an ASCII format.
* The overall effect of this combination of features is a text
* search program, that in the words of PC magazine (1/31/89),
* "..holds its own with the best commercial programs."
*
* Since then, Lotus has introduced Magellan, a shell with text
* search. This $179 program will take two megabytes out of a
* 20meg hard disk for an index to the entire disk. I have
* looked at it briefly and I'm impressed. Fast searches and
* "launching" into the appropriate program. But I feel that
* anyone who needs that, should ALSO have MaxFind. Because,
* after all, finding "lost" information is not an easy job with
* ANY program. MaxFind is the preferred tool for these cases:
* - Names and words with unknown spelling.
* - Longer documents. With my limited exposure to Magellan,
* it appears that it finds FILES very quickly, but its up
* to you to scroll through the document. MaxFind will
* show you up to 24 found word(s), in context, on one
* screen.
* - Finding a quote. Magellan doesn't index about 150 common
* words. If many of these are in the quote - problems.
* - It won't fit on a floppy based laptop.
*----------------------------------------------------------------------
* (PCED) synonymns to search from a file list
*
* MaxFind does not have the option of searching from a file list.
* However PCED by Chris Dunford with the following synonyms using the
* "@@file list" option will search from the file list "sm.lst".
*
* rem PCED synonyms for MaxFind Search, Syntax: SMC1 [search text]
*
* SYN smc1 'cef^cancel &A^delc^mfc &A^qec^cen'
* SYN cancel 'if "&A" == "" CED CANCEL notxt'
* SYN notxt 'echo No search text, Syntax: SMC1 [search text]^cen'
* SYN cef 'CED ECHO OFF^echo off'
* SYN delc 'if exist c:\! del c:\!'
* SYN cen 'echo on^CED ECHO ON'
* SYN mfc 'mf.exe -ntl &A @@sm.lst>>c:\!'
* SYN qec 'q.exe c:\! /Esm.mac /Lsm.mac'
* rem SYN mfc 'mf.exe -ntl &A @@e:\up\sm.lst>>c:\!'
* rem SYN qec 'q.exe c:\! /Ee:\up\sm.mac /Le:\up\sm.mac'
* NOTE: Change "e:\up\" to the directory where sm.mac and sm.lst reside.
* "REM" lines are my setup.
*
* You must have PCED v2.00 or later with the Filelist progam FL.EXE
* loaded. These synonyms are in sm.sym and can be loaded with SM_SYN.bat
* File list sm.lst is only one line "*.tst" for testing. To test,
* type "smc1 aaa" <enter> after loading these synonyms. You should
* see the following file loaded after the macro completes running:
*
* +- Searching> SM.TST
* 3:aaa bbb ccc ddd eee fff ggg hhh iii jjj jjj lll mmm nnn ooo
* Here's the file list I keep in e:\up\sm.lst:
*
* *.qm
* *.ql
* *.inf
* *.bat
* *.lst
* *.me
* *.doc
* *.syn
* *.new
* *.tst
* e:\syn\sa.syn
* u:\sr?.bat
* (OTHER) MACROS:
*
* See SRCxxx.QM in AMACxx.Zip for search and search/replace macros using
* Chris Dunford's excellent FGREP.COM.com.
* ******* (CAUTION) ***********
*
* Letters "S~~" and "R~~" must NOT occur in any other Dos environment
* variable name or value.
*
* (ENVIRONMENT) Variables - See SRCHxx.QM for discussion
* (REQUIRED) PROGRAM FILES
*
* You──MUST──have the exectable program files in AMAC-PRG.ZIP to run
* some of these macros. AMAC-PRG.ZIP can be found on the following BBS's:
*
* SemWare
* Exec-PC
*
* It can not be found on CompuServe since many of the programs are
* Copyrighted. All program files are ShareWare, and inclusion in
* AMAC-PRG.ZIP is not prohibited in their documentation.
*
* MAXFND23.ZIP and INPUT.ZIP are the only files necessary to run SM.BAT.
*
* INPUT can be found on Exec-PC as INPUT.ZIP. MAXFIND v2.3 can be found
* on CompuServe IBMSYS Lib 3 as MAXFND.ZIP and on EXec-PC as
* MAXFND23.ZIP
*
* AMAC-PRG.ZIP contains:
* ----------------------
* Name Length Method SF Size now Mod Date
* ============ ======== ======== ==== ======== =========
* INPUT.ZIP 3097 Stored 0 3097 07 May 86
* MAXFND23.ZIP 24247 Stored 0 24247 26 Apr 90
* RJ.ZIP 9965 Stored 0 9965 01 Dec 90
* FGREP172.ZIP 12513 Stored 0 12513 19 May 90
* DX211.ZIP 100895 Stored 0 100895 17 Mar 89
* AMAC-PRG.INF 3138 Imploded 67 1014 23 Apr 91
* ============ ======== ======== ==== ======== =========
* *total 6 153855 ZIP 1.10 0% 152329 23 Apr 91
*
* I thank the authors for these excellent programs.
*
* ----------------------------------------------------------------------
* @(6) - Srch ONLY from command line, loads files w/sm.bat, no replace *
* -------------------- uses MaxFind mf.exe ----------------------------- *
**** MUST BE THE FIRST MACRO IN THIS FILE TO BE USED WITH SM.BAT ****
*
@6 macrobegin
altwordset * For all file names
begfile * Just in case!
* ----------------- delete MaxFind Copyright header -----------------*
header: *
find "xfind C" return return * Find MaxFind header
jfalse end_header: *
delline * Delete it until no more
jump header: *
end_header: *
* --------- delete "Hex file skipped" message and file name ---------*
begfile * Back to tof
hex: *
find "Hex file s" return return * Find "Hex file skipped" msg
jfalse end_hex: *
delline * Delete it until no more
cursorup * Move up to hex name
delline * Delete it
jump hex: * And do until done
end_hex: *
begfile * Back to tof
* ------------------ delete file names with no text ------------------*
cleanup: *
begline * Position for find
unmarkblock *
markline markline * Mark line to check if name
find "g>" return "L" return * Check if name
jtrue name: * If name, check if next line
* is also name
cursordown *ELSE move down to next line
jfalse end_cleanup: * If can't move down, at eof
jump cleanup * Check this line if name
name:
cursordown * Is a file, move down to next
* line
jfalse delete: * If can't move down, at eof
* and it's a name, go delete it
cursorright *ELSE put cursor on >
unmarkblock *
markcolumn * Begin mark
cursorleft * Move left one space
markcolumn * Mark column to check for "g>"
cursorleft * Move to "n" in "Searching"
find "g>" return "L" return * Is line a name?
jfalse cleanup: * If not a name, go to cleanup
cursorup *ELSE must be text, move back
* up to where we were
jfalse end_cleanup: * If can't move up, at tof
delline *ELSE Delete name with no text
jump cleanup: *
delete: *
delline * Delete last line if name
end_cleanup: *
* -------------------- load file names with text --------------------*
endfile * Start to load at eof
load: *
begline * Position for find
find "g>" return "B" return * Find line with file name
jfalse text: * No more file names? Move up
wordright *wordright wordright * Move to file name
unmarkblock * Clear last mark
markcolumn * And begin mark
endline * Get all name in block
copy * Copy file name to scrap
EditFile * Get ready to load
CurrentFilename " " * To force return *here*
Paste Return * Paste file name & do it!
text:
cursorup * Go to next line
jfalse end_load: * No more file names? End load
jump load: *ELSE more files to load
end_load: *
* --------------------- "No found text" message ---------------------*
cursordown cursorup * Test if any search text found
jtrue find_set: * If found, move on
"No found text " *ELSE no find, display this
jump end: * End macro if no found text
find_set: *
* -------------------- initialize find for search --------------------*
editfile "c:\$" return * Load tempfile
find "S~~" return return ** Find S~~ in SET output
find "=" return return * Move to =
cursorright * Move first character
markcharacter * Mark it
endline * Move to end of text
copy * Copy search text to scrap
killfile quit * Kill/quit temp for next time
Find paste return Escape * Initialize find for F4
* ------------------------------ reset ------------------------------*
end: defaultwordset * Reset
*
* 233 bytes Wed 04-17-1991 16:35:04
* 216 bytes Wed 04-24-1991 14:18:01 moved DOS "set>c:$" to SM.BAT
* replace R~~ with S~~
* 221 bytes Tue 04-30-1991 22:28:02 changed initialize find routine
*
* ----------------------------------------------------------------------
* (f4) Finds search text in file after loading
* ----------------------------------------------------------------------
*
f4 repeatfind
*
* ----------------------------------------------------------------------
* (f5) prevfile
* ----------------------------------------------------------------------
*
f5 prevfile
*
* ----------------------------------------------------------------------
* (f6) nextfile
* ----------------------------------------------------------------------
*
f6 nextfile
*
* ----------------------------------------------------------------------
* @(h) Finds first word on cursor line marked in document below
* ----------------------------------------------------------------------
*
* Press @ and h at the same time. Cursor down to desired line in Index.
* Press <enter> to locate the desired item from the Index. See
* Bookxx.Qm in AMACxx.Zip for more discussion.
*
@h macrobegin
begfile
unmarkblock
markline markline
pause
wordright
markword
copy
endpara
find "(" paste ")" return return
begline
*
* 22 bytes Tue 04-09-1991 16:23:53
* (Version) history:
* A - Initial
* B - Modified "No found text" message handling.
* - Wrong copy of sm.bat in AMAC-B.ZIP -corrected.
* C - Changed PCED synonym to show directory/path.
* - Corrected @6 to handle "window" searches and initialize
* find for F4 correctly.
* - Changed examples.
* - Left sm.lst out of amac-c.zip, added it.
* D - Changed PCED synonyms to use "CED CANCEL".
* E - Changed find initialize FGS to FGR to find replacement
* text with F4 IN @6.
* F - Shortened SM.BAT by removing "Mode" output.
* - Removed DelLine and UnMarkBlock from @6
* G - Moved DOS "set>c:$" to SM.BAT
* - Corrected @6 find initialize FGR to FGS to find search
* text with F4 in @6.
* H - Changed FGR to R~~
* - Changed FGS to S~~
* - Changed initialize find routine in @6
* K - Added reference to environment variables.
* L - Minor documentation changes.
* M - Changed SRCHxx version from 2.9 to 3.0. 8/6/91
* N - Changed SM-SYN.BAT name to SM_SYN.BAT. 8/26/91
*
*
*
*
*
*
*
*