home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
editors
/
amac41.arj
/
SRQ.QM
< prev
next >
Wrap
Text File
|
1991-05-06
|
7KB
|
122 lines
* SRQ.QM May 6, 1991
* --------------------------------------------------------------------
* @(4) Search/replace from command line, quit each file after rplcmnt.
* --------------------------------------------------------------------
*
* Often the total size of files needing a "replacement" will exceed the
* available memory when using SR.BAT and the startup macro @0. Macro @4
* in SRQ.QM is simply a modification of @0 by replacing savefile with
* file, so each file is quit after replacement.
*
* This macro must be the first macro in the file because it is used as
* the startup macro with SRQ.BAT. It cannot be run from command line!
*
@4 MacroBegin
altwordset * For all file names
* ------------------ display "No found text" message -----------------*
cursordown cursorup * Test if any search text found
jtrue START: * If found, move on
MESSAGE: *
"No found text " * If not found, display this
jump END: * End macro if no found text
START: *
* ---------------------------- load files ----------------------------*
endfile * Get to end of file
LOADAGAIN: *
unmarkblock * Unmark last file name
find #42 "Fi" return "B" return* Find file name
jfalse MESSAGE: * No find ?, show message, end
wordright * Move to space
wordright * Move to file name
markcolumn * Mark it
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!
cursorup * Go to next line
jfalse ENDLOAD: * No more filenames? Done load
jump LOADAGAIN: * Check again
ENDLOAD: *
quit * Quit c:\! from ring so no rplc
* -------------------- get search text to scratch --------------------*
editfile "c:\$" return * Load set output file
find "S~~" return return * Find S~~ |2.7
find "=" return return * Move to = |
cursorright * Move first character |
markcharacter * Mark it |
endline * Move to end of text |
storescrbuff "S~~" return * Store SEARCH text to scratch |
* ------------------- get replace text to scratch -------------------*
unmarkblock * Get ready
begfile * Get to top
find "R~~" return return * Find R~~ |2.7
find "=" return return * Move to = |
cursorright * Move first character |
markcharacter * Mark it |
endline * Move to end of text |
storescrbuff "R~~" return * Store REPLACE text to scratch|
killfile * Kill c:\$ for next time
quit * Remove c:\$ from ring
* --------------- get search/replace text from scratch ---------------*
Editfile "NUL" Return * Insert -or- GoTo NUL File
getscrbuff "S~~" return cut * Cut search text from scratch |2.7
Find paste Return escape * Initialize find prompt
getscrbuff "R~~" return cut * Cut replace text from scratch|2.7
FindReplace return * Begin replacement
paste return * paste REPLACEMENT text
"GIN" * Replace options
* pause ** Add this to pause for options
return * MUST include "GN"
* ------------------ load files, do search/replace ------------------*
Begline Cursorright * Put cursor in Col. 2 of NUL File
LOOP: * Main test loop
Nextfile * Move to next files in Ring
Cursorleft * Move cursor left (need for NUL test)
Jfalse DOIT: * If couldn't move to left, it's not
* the NUL File AND cursor position
* has not changed -- GO with the
* FindReplace
*ELSE
* Check to see if in the NUL File
Cursorleft * Move cursor left for NUL Test
Jfalse ENDLOOP: * If couldn't move left -- We
* ARE in the NUL File and Need
* to ENDLOOP
*ELSE
Cursorright * Move back to Col. 2 in NUL File
DOIT: * FindReplace Loop
BegFile * Move up in case cursor is below find
Repeatfind * Do the FindReplace
Jtrue SAVE: * If CHANGES are made -- SAVE the File
Quit * If NO CHANGES are made -- QUIT the
* File
Jump LOOP: * Return to the Main Loop
SAVE: * Routine to Save a File with Changes
File * Save and quit this file after rplcmnmt
Jump LOOP: * Return to Main Loop
ENDLOOP: * Loop is DONE
Quit * Quit the NUL File
END: *
* ------------------------------ reset ------------------------------*
defaultwordset * Set default
*
* 153 bytes Tue 10-02-1990 18:50:33
* 200 bytes Thu 04-25-1991 12:02:23 added "No found text" message
* added "GIN" auto replace option
* changed file "_" to NUL", faster
* changed "c:" to "c:\"
* 208 bytes Tue 04-30-1991 22:16:22 changed search and replace to scrap
* (F4)
f4 RepeatFind
* (F5)
f5 PrevFile
* (F6)
f6 NextFile
* Tom Hogshead