Simple Code Searcher

Blitz3D Forums/Blitz3D Programming/Simple Code Searcher

virtlands(Posted 2013) [#1]
Hi, most of us have lots of *.BB or *.BMX files lying about, and probably 1000's of them in a directory, ...

In my case I have over 5000 BB files (in various dirs).

Sometimes I forget where certain code is (whether it's made by me or someone else).

So, I thought of making this program here, called "Simple Code Searcher".

What it does is scan any list of directories that you configure it to scan; It shall scan the AppDir (where the program is) by default.

How it works:
You input a keyword to search for, and it displays all lines in the
BB or BMX files that contain that keyword.

One very popular keyword to search for = "FUNCTION",
because we forget where certain code is that we made sometimes.

I made this in a hurry, took about 3 hours to make it, so it's not something fancy.
It won't recurse to deeper sub-directories, so if necessary just make a copy all your BBs into 1 place, so that it can have access.

You can download it from this link if you prefer:
http://uploadingit.com/file/g9tuwkpcoiv38p2q/SimpleCodeSearcher.zip

Here's the B3D program:


; The program is coded to ignore comments, but if you want
; it to search through comments then just change the Global Variable as you wish.
Global IGNORE_COMMENTS=True

; There is a portion of the code that has this path(..) array:
; Just change these directories to your own directories that you
; wish to search;

path(0) = AppDir$ ;; The default
path(1) = "C:\Blitz3d Projects\" ;; Replace these
path(2) = "C:\wonderlands\rtw\"
path(3) = "C:\Blitz3D\"

;path(4) = "."
;path(5) = "." ;; etc...
;path(10) = "."
;---------------------------------------------------------------

Here's a sample screenshot where it searches for the keyword: FUNCTION


You can search for anything you want, like "DIM", or "bit" or whatever.

If you think this is useful or not, let me know.


Axel Wheeler(Posted 2013) [#2]
Nice job!

FYI, The AppDir location doesn't actually scan the directory the bb file (your program) is in, it has to be compiled (exe). But then it works.

When I put an absolute path into the path$ array, it works fine also.

Anyway, thanks!


virtlands(Posted 2013) [#3]
Glad you tried it.

There is this free program called UltraFileSearch that does similar.

http://www.ultrafilesearch.com/download.html

{The basic difference is that my prog displays the actual lines of info.)


Bobysait(Posted 2013) [#4]
you could try with a recursive function
it's way easier to search for keywords.



this code will export the results in the "out" file.


Addi(Posted 2013) [#5]
Am I allowed to modify your code?
I would like to include a GUI and a menu for options.


Bobysait(Posted 2013) [#6]
Codes deposed on the forum without copyright or explicit license are generally "open" and free to use.

(at least, I assume you can use mine)