Search for text in Blitz source files!

Miscellaneous Forums/General Discussion/Search for text in Blitz source files!

You may have tried in the past to search for text in bb or bmx files, and noticed you can't do it! Why? You can search text files, and C files just fine, and these are just text files! What's going on!

Well as usual, Microsoft are being idiots. They decided in their infinite wisdom that they could make searches faster if they simply didn't search half the files! The only files they search are files which have some special text search thingy registered for them. Otherwise, you're out of luck, EVEN IF YOU ENTER THE SPECFIC FILENAME YOU WANT IT TO LOOK IN!

Well there is a fix, but you'd never have found it on your own most likely:

http://support.microsoft.com/?id=309173

Use method 2, and you will be able to search for text in every file type in Explorer.

Stupid Microsoft! This has annoyed me for years!

They decided in their infinite wisdom that they could make searches faster if they simply didn't search half the files!
lol. Classic! :P

Well as usual, Microsoft are being idiots.
There you go answering your own question again.

It never bothered me. I've been using Directoy Opus for years, and its built-in search function searches all the files you ask it to, not only the ones it thinks are text.

Use grep. I even made a grep app in the B+ samples...

Yeah, this one caught me out too. Nearly gave my PC a spinning piledriver because of it.

Someone should write a book "What new things are totally gay in XP!"

Great searcher:

Inforapid Search & Replace, http://www.inforapid.de/html/searchreplace.htm


(Also capable of mass Search & Replacing across entire directory structures should you so desire. Needless to say, be careful with that feature. ;-)

Thanks sswift, I've been bitten by this for years. Method 2 works wonders.

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.
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


I use Windows Grep for all my in-file searching.

I fixed it a couple of years ago when I realised I could search my Delphi source files (extension .pas).

I use UltraEdit for text related searches.

I could use something else, but I just like to be able to go: Ctrl+F then type in something into the "containing text" edit (I use Win2000 style search) it's so easy.

dopus... as flameduck said. Nothing beats it. Just set it up to replace windows explorer and yer ctrl-f works the same way. but BETTER. :)

Lol, err.

I'd never have found it?

Like this?

http://www.google.co.uk/search?hl=en&q=%22windows%22%2B%22search+all+files%22&btnG=Google+Search&meta=

lol, good search. So many people don't know about " in Google. The average amount of words entered in a search is still < 2 I believe. Imagine typing in "Holiday" or something haha, what dumbasses most people most be ho hum.

EDIT : Wrong topic.

Lost of suggestions have been made... I personally use Total Commander...