gav46 Posted July 31, 2005 Share Posted July 31, 2005 does AutoIT have a simple function to search a file for specific text (and return msg with result)? Something like the dos findstr command..... I have a log file (c:\Applog.txt) which appends with each successful application install. I want to check this file before running an app to see whether the user has already run this app in the past.... thanks Link to comment Share on other sites More sharing options...
FuryCell Posted July 31, 2005 Share Posted July 31, 2005 (edited) does AutoIT have a simple function to search a file for specific text (and return msg with result)?Something like the dos findstr command.....I have a log file (c:\Applog.txt) which appends with each successful application install. I want to check this file before running an app to see whether the user has already run this app in the past....thanks<{POST_SNAPBACK}>Something Like:$TextFile="TextFile.txt" $What2Find="One" $Text=FileRead($TextFile,FileGetSize($TextFile)) $Pos=StringInStr($Text,$What2Find,1) Select Case $Pos=0 MsgBox(0,"Not Found",$What2Find & " was not found in " & $TextFile) Case Else MsgBox(0,"Not Found",$What2Find & " found in " & $TextFile & " at offset " & $Pos) EndSelectJust change "Textfile.txt" to the path of the textfile you want to search and "One" to what you want to find in the textfile. Edited July 31, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
gav46 Posted August 2, 2005 Author Share Posted August 2, 2005 Thanks for that..... I changed the line $Pos=StringInStr($Text,$What2Find,1) to $Pos=StringInStr($Text,$What2Find) otherwise it only searched the first line in the file and not the whole document.. Great Thanks again Link to comment Share on other sites More sharing options...
FuryCell Posted August 2, 2005 Share Posted August 2, 2005 Thanks for that..... I changed the line$Pos=StringInStr($Text,$What2Find,1)to$Pos=StringInStr($Text,$What2Find)otherwise it only searched the first line in the file and not the whole document..GreatThanks again<{POST_SNAPBACK}>Your Welcome HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. 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