Source language: Translate to:

Outside of exe text file search? - search contents of extern

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

Outside of exe text file search? - search contents of extern

Postby Jim Brammer » Thu Feb 07, 2002 5:33 pm

Outside of exe text file search?

I was wondering if there was a way to search files for keyword(s) within files that were not embeded into the final .exe

This would be either on a diskette or CD-Rom (most likely a CD-Rom).

And return the results.

So, say I did a big manual on repairing corvettes. I have all these text files, but how to search them?



Use NeoBook's FileRead command and some of the String commands.


Two things come to mind, "lots of files" and return the results in a "pretty" format.  



First, create an ascii file list of the text files that you want to search. There are many ways to do this and shouldn't be a problem.

Next put a Text Entry box on your page.
and a ListBox
and a Button.

Paste this into your Button Action...

FileLen "textlist.txt" "[ListLen]"
Loop "1" "[ListLen]" "[LX]"
FileRead "textlist.txt" "[LX]" "[TextFile]"
FileRead "[TextFile]" "ALL" "[ALL_Text]"
SearchStr "[Search_For]" "[ALL_Text]" "[Is_Found]"
If "[Is_Found]" "<>" "0"
ListBoxAddItem "ListBox1" "0" "[TextFile]"
SetVar "[ALL_Text]" ""

You enter the text that you want to search for into the TextEntry box. When you press the button the loop loads each file into memory one at a time and searches for the search string. If it's found, that filename gets added to the ListBox. It's a pretty simple list and, it's very fast. There's also a lot more that can take place when the search text is found but I kept it simple for pasting here - just to get the idea across.
Jim Brammer

Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 1 guest