home *** CD-ROM | disk | FTP | other *** search
- REM **********************************************************************
- REM **************** Exclusive Property of Softbridge ********************
- REM **********************************************************************
-
-
-
- '------------------------- Subprogram Grep -------------------------
- sub grep
- Dim message$
- Dim finds%
-
- do
- begin dialog GrepDialog 100,60
- caption "GREP search"
- text 5,7,40,10,"GREP for:"
- textbox 40,5,55,13,.text
- checkbox 20,18,70,13,"case sensitive",.case
- text 5,50,90,10,message$
- ButtonGroup .button
- Button 5,33,40,15,"GREP"
- Button 55,33,40,15,"Exit"
- end dialog
-
- dim sf as SearchFind
- dim ed as Edit
- Dim gd as GrepDialog
-
- Dialog gd
- if (gd.button = 1) then exit do
- if (gd.text = "") then
- message$="Nothing to GREP for."
- goto nextDo
- end if
-
- finds = 0
-
- ed.selStart = 0
- ed.selEnd = 0
- Edit ed ' Go to top of text
-
- sf.searchFor = gd.text
- sf.forward = 1
- sf.caseSensitive = gd.case
- sf.quiet = 1
- SearchFind sf
- do
- GetCurValues sf
- if (sf.found <> 0) then
- finds = finds + 1
- SearchFind sf
- end if
- loop while sf.found <> 0
-
- select case finds
- case 0
- message$="Didn't find '"+sf.searchFor+"'."
- case 1
- message$="Found '"+sf.searchFor+"' 1 time."
- case else
- message$="Found '"+sf.searchFor+"'"+str$(finds)+" times."
- end select
-
- nextDo:
-
- loop
- end sub
-
- '------------------------------ MAIN --------------------------------------
- sub Main
- Call Grep
- end sub
-