Source watts on the 15.07.2007 from the MMJ-Quellcodesammlung (Dietmar horn) in The Babyklappe on XProfan.Com stored:
Text search (in Files)
executable ex Profan-Version 5.0
declare i%,listbox1&,Listbox2&,input$,button0&
declare File$,row$,File$,z%,ok%,edit2&,fz$
declare ok$,edit&,button1&,button2&,len%,fz2$,number$
declare radiobutton1&,radiobutton2&,found%,text&
PROC KLICK WICHTIG WEGEN EINFACHKLICK
getmessage
Case (%message,512): Return
ENDPROC
PROC SEARCH
let found%=0
@destroywindow(Listbox1&) circa anew To fill
@destroywindow(Listbox2&) circa anew To fill
and restore
Let ListBox2&=CreateListBox(%hwnd,,10,200,472,97)
Let ListBox1&=CreateListBox(%hwnd,,10,10,472,97)
FILEMODE 0
let I%=0
let input$=GETTEXT$(EDIT&)
assign #1,File$
reset #1
Clear ok$
whilenot eof(#1)
input #1,row$
addstring(LISTBOX1&,@UPPER$($ row))
wend
close #1
assign #1,File$
reset #1
case @GetCheck(Radiobutton1&):let input$=input$;
let fz$=mid$(input$,1,1)
len%=@Len(input$)
whilenot eof(#1)
input #1,row$
let OK$=getstring$(LISTBOX1&,i%)
let ok%=@Instr(upper$(input$),OK$)
if @gt(ok%,0)
if @GetCheck(Radiobutton1&)
let OK$=@Mid$(OK$,ok%,len%)
let ok$=upper$(ok$)
let ok$=ok$;
row$=@Trim $($ row)
let fz2$=mid$(row$,1,1)
let input$=upper$(input$,)
if @and( @equ$(input$,ok$),equ$(fz$,fz2$))
ADDString(LISTBOX2&,row$)
inc found%
let number$=it get ,found%;x ,input$, in,File$,found
settext text&,number$
endif
Elseif @getcheck(Radiobutton2&)
let OK$=@Mid$(OK$,ok%,len%)
let ok$=upper$(ok$)
let input$=upper$(input$)
if @equ$(input$,ok$)
ADDString(LISTBOX2&,row$)
inc found%
let number$=it get ,found%;x ,input$, in,File$,found
settext text&,number$
endif
Endif
endif
INC I%
WEND
CLOSE #1
let number$=it get ,found%;x ,input$, in,File$,found
settext text&,number$
ENDPROC
SetTrueColor 1
Window Style $003F
Window 10,10-500,400
Windowtitle After Text search
UseFont MS Sans Serif,13,0,0,0,0
SetDialogFont 1
cls RGB(192,192,192)
Let ListBox2&=CreateListBox(%hwnd,,10,200,472,97)
Let ListBox1&=CreateListBox(%hwnd,,10,10,472,97)
Let Edit2&=CreateEdit(%hwnd,here File (or Button clicking),11,160,172,21)
Let Edit&=CreateEdit(%hwnd,here Suchtext,10,120,172,21)
Let Button1&=CreateButton(%hwnd,GO!,240,120,80,25)
Let Button2&=CreateButton(%hwnd,File dial,240,160,80,25)
let button0&=CreateButton(%hwnd,,0,0,0,0) so Program whom Focus rather settle can
Let RadioButton1&=CreateRadioButton(%hwnd,Text very search,340,120,140,17)
Let RadioButton2&=CreateRadioButton(%hwnd,Text about search,340,140,140,17)
Let Text&=CreateText(%hwnd,here becomes The found Suchanzahl displayed,10,320,470,17)
setcheck Radiobutton1&,1
while 1
waitinput
if getfocus(button2&)
KLICK
let File$=@LOADFILE$(ÖFFNE:,*.prf)
settext edit2&,File$
setfocus(button0&)
elseif getfocus(button1&)
KLICK
if @and(@neq$(File$,),@neq$(gettext$(Edit&),here Suchtext))
SEARCH
elseif @equ$(File$,)
@MessageBox(Please File dial,Error,16)
elseif @equ$(gettext$(Edit&),here Suchtext)
@MessageBox(Please right Suchtext prompt!,Error,16)
endif
setfocus(button0&)
endif
wend