A very crude and simple piece of code I use.
Just compile it as an exe, drop it into your .bb files folder, run, and type in the search word/phrase.
If no search, then it just counts the number of lines of code.
Just compile it as an exe, drop it into your .bb files folder, run, and type in the search word/phrase.
If no search, then it just counts the number of lines of code.
Type Dir Field loc$ End Type Graphics 640,480,16,2 AppTitle "Countlines" fnt = LoadFont("Courier New",14) : SetFont fnt Global find$, oldfind$ ;------------------------------------------ While Not KeyHit(1) search() Wend End ;--------------------- Function search() ;--------------------- Cls Locate 0,0 oldfind$ = find$ find$ = Input$("Find:"+oldfind$) If find$="" And oldfind$<>"" find$=oldfind$ EndIf AppTitle "Countlines - "+find$ Print "Counting lines..." Print "-----------------" totalfilesize = 0 totalfilecnt = 0 column = 0 columnwidth = 20 columnspc$ = String$(" ",columnwidth) columnmax = 80/columnwidth dir.Dir=New Dir dir\loc$=CurrentDir$() While dir<>Null lis=ReadDir(dir\loc$) If Not lis Then RuntimeError "Failed to read the '"+dir\loc$+"' directory" filename$=NextFile(lis) While filename$<>"" If KeyHit(1) Then End Select FileType(dir\loc$+filename$) Case 1 If Right$(filename$,3)=".bb" totalfilecnt = totalfilecnt + 1 Color 255,255,255 Write Left$(filename$+columnspc$,columnwidth) column = column + 1 : If column = columnmax Then column = 0 : Print totalfilesize = totalfilesize + FileSize(dir\loc$+filename$) file = ReadFile(dir\loc$+filename$) indfile_linecnt = 0 found = 0 While Not Eof(file) txt$=ReadLine(file) indfile_linecnt = indfile_linecnt + 1 If txt$<>"" And Left$(txt$,1)<>";" Lines=Lines+1 If find$<>"" If Instr(Upper$(txt$),Upper$(find$)) Color 255,0,0 Write Str$(indfile_linecnt)+" " found = 1 EndIf EndIf Else Blanks=Blanks+1 EndIf Wend CloseFile file If found = 1 column = 0 : Print EndIf EndIf End Select filename$=NextFile(lis) Wend CloseDir lis Delete dir dir.Dir=First Dir Wend Color 255,255,255 Print Print "-----------------" kb#=Float#(totalfilesize)/1024 mb#=Float#(totalfilesize)/1048576 Print "Total filesize: "+totalfilesize+" bytes ("+Left$(kb#,Len(kb#)-4)+" kb / "+Left$(mb#,Len(mb#)-4)+" mb)" Print "Total files: "+totalfilecnt Print "Total lines: "+(Lines+Blanks) Print "-----------------" Print "Press any key..." WaitKey End Function