home *** CD-ROM | disk | FTP | other *** search
- /*
- @BFind And Replace @P@ICopyright Gold Disk Inc., Jan, 1993
-
- This Genie will search and replace across all articles in a document.
- */
- if ~show(l, "gdarexxsupport.library") then
- if ~addlib("gdarexxsupport.library", 0, -30) then
- do
- call ppm_Inform(1, "Please install the gdarexxsupport.library in your libs: directory before running this Genie.")
- exit
- end
-
- cr = '0a'x
-
- address command
- call SafeEndEdit.rexx()
- call ppm_AutoUpdate(0)
-
- oldsearch = getclip(ppuser_search)
- oldreplace = getclip(ppuser_replace)
-
- form = ppm_GetForm("Enter Search String..", 50, "Search for:"oldsearch ||cr"Replace with:"oldreplace)
-
- if form = '' then exit_msg()
-
- parse var form search '0a'x replace
-
- if search = '' then exit_msg("Search string required")
-
- case = ppm_Inform(2, "Case sensitive?", "No","Yes")
-
- call setclip(ppuser_search, search)
- call setclip(ppuser_replace, replace)
-
- box = ppm_DocFirstBox()
- call ppm_ShowStatus("Working..")
-
- ud = (randu() * time(s)) % 1
-
- do while box ~= 0
-
- if upper(word(ppm_GetBoxInfo(box), 1)) = 'TEXT' & ppm_GetBoxUserData(box) ~= ud then
- do
- oldbox = box
-
- box = ppm_ArtFirstBox(box)
- boxtext = ppm_GetArticleText(box, 1)
-
- /* replace string is called from the gdarexxsupport.library */
- boxtext = replacestring(boxtext, search, replace, case)
- call ppm_DeleteContents(box)
- call ppm_TextIntobox(box, boxtext)
-
- do while box ~= 0
- call ppm_SetBoxUserData(box, ud)
- box = ppm_ArtNextBox(box)
- end
-
- box = oldbox
- end
-
- box = DocNextbox(box)
-
- end
-
- call exit_msg("Done!!")
-
- exit_msg: procedure
- do
- parse arg message
-
- if message ~= '' then call ppm_Inform(1, message,)
- call ppm_ClearStatus()
- call ppm_AutoUpdate(1)
- exit
- end
-
-