News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Find text in files

Started by Jimg, April 30, 2007, 04:31:30 PM

Previous topic - Next topic

Jimg

Here's a little program I've been working on.

FindAll

This program allows you to search files within a folder and all sub-folders for text strings.
It is free for all purposes except it may not be copyrighted in such a manner that will prevent people from using it.

It was written for my own use to search the many megabytes of sample code I have amassed for examples and snippets. It will only search the first 4GB of any file.

The program will keep all settings in an .ini file. It will not itself write in the registry.

To use, first select a starting folder to search.
You may click on the ... button to search for a starting folder.
See below for a way to automatically select folders by right-clicking.

Select which files you want to search.
Files specifications are entered separated with a blank.
Wild card characters ? and * are allowed in file specifications.
*.asm is the same as just .asm
abc is the same as abc.*
You may select a preset file specifications from the dropdown.
You may edit the contents of the dropdown by pressing the ... button.

Enter search strings in the first edit box.

You may enter as many strings as you desire (up to the max for an edit box).
Each line represents one search string.
Embedded and trailing blanks are significant.
The program will search for each search string individually, not as a whole block.
Any line found that contains at least one of these strings will be output, unless it also contains one of the disqualifying strings.

Enter any disqualifying strings in the second edit box.
These work just as the search strings above.
Any line containing one of these strings will be discarded.

You may save the strings entered in a file if you wish.

You may read in saved strings from a previously saved file.

Enter the desired path and name of the output file.

Select any other desired criteria from the check boxes on the right.

Press the Search button.
The program will search every qualifying file for the strings entered.
The results if any will be written to the output file.

Press the Edit Output button to see the results.
You may press the Edit Output button before searching to see the results of the previous search.

Make a folder where you want to keep the program.

Copy FindAll.exe and FindAll.ini to the folder.
You can change the names, it's not important.

For best functionally, I add a right-click context menu to windows that will allow you to run the program by right clicking on a folder name.
The file named FindFile.reg contain the commands to add to the registry.

Edit the FindAll.reg file to point to the new folder.

Change the last part "Find Text In Files" to whatever you like.
[HKEY_CLASSES_ROOT\Directory\shell\Find Text In Files]

Make it the same for the next line.
[HKEY_CLASSES_ROOT\Directory\shell\Find Text In Files\command]

Make the last line point to where you put the program.
@="\"C:\\Program Files\\FindAll\\FindAll.exe\" \"%1\""
Note: the double slashes are required.

When done, double click on the FindAll.reg file to add it to your registry.


Please let me know if you find any bugs, etc.

-Jim

p.s.  As always, it contains the full source code.  Enjoy.

[attachment deleted by admin]

PBrennick

Jim,
Very nice, thank you very much. It is one of those things I always planned on writing but never had the time. I use Mark Jones INI file searcher but that is all it will search, this is better!

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Ehtyar

Incredibly impressive, thank you Jimg :)

Ehtyar.

Jimg

Thank you Ehtyar, Paul,  I hope you get as much use out of it as I do  :bg

skywalker

Thanks Jim.

Gentleman,scholar, and meticulous.

Andy

Mark Jones

Quote from: PBrennick on April 30, 2007, 07:40:11 PM
Jim,
Very nice, thank you very much. It is one of those things I always planned on writing but never had the time. I use Mark Jones INI file searcher but that is all it will search, this is better!

Paul

Hi Paul, actually my "IncFind" tool should be able to search through an entire folder, just use Path\*.* as one of the search locations. Might beep twice from trying to open the "." and ".." file though, whoops. :lol  But perhaps someone can find it useful:

http://www.masm32.com/board/index.php?topic=3863.0
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08