datkewlguy Posted January 31, 2005 Share Posted January 31, 2005 well im trying to make a program that searches our school website under a certain page and checks if there are cancellations. I have it setup so it will download the page as a .txt but i dont know how to search the file for a particular word(s) and need to be able to. Any ideas? Link to comment Share on other sites More sharing options...
datkewlguy Posted January 31, 2005 Author Share Posted January 31, 2005 so theres no way to search a txt file for a word? come on i know there is, just my way is really messy... Link to comment Share on other sites More sharing options...
SlimShady Posted January 31, 2005 Share Posted January 31, 2005 (edited) Here you go. Edit: - Forgot error checking. If FoundInFile("test.txt", "James") Then MsgBox(64, "Test", "Yes. The string is found!") Else MsgBox(64, "Test", "No. The string is NOT found!") EndIf Func FoundInFile($File, $String) Local $Found Local $Content Local $FileSize If NOT FileExists($File) Then Return 0 $FileSize = FileGetSize($File) $Content = FileRead($File, $FileSize) $Found = StringInStr($Content, $String) $Content = "" If $Found Then Return 1 Return 0 EndFunc Edited January 31, 2005 by SlimShady Link to comment Share on other sites More sharing options...
datkewlguy Posted January 31, 2005 Author Share Posted January 31, 2005 thanks a bunch! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now