Doxie Posted October 29, 2004 Share Posted October 29, 2004 Hi,It was a while since i last made a AU3 script, and my head is completly empty.If i have a txt file that is not built as a Reg file with headers etc. but i still wanna search it, how do i do that? Using loops?The contet of the file looks like this:Some of the text from the fileProduct ID: 55274-640-1597616-23794 Original Install Date: 2004-09-20, 23:07:11 System Up Time: 0 Days, 1 Hours, 39 Minutes, 29 Seconds System Manufacturer: Hewlett-Packard System Model: Compaq nc4000 (DG245A#AK8) System type: X86-based PC Processor(s): 1 Processor(s) Installed. [01]: x86 Family 6 Model 9 Stepping 5 GenuineIntel ~1393 Mhz BIOS Version: COMPAQ - 27090320I now wanna search the file for BIOS Version: for example, but how? : Thanks in advance Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
SlimShady Posted October 29, 2004 Share Posted October 29, 2004 This should help you $Found = "No" $TxtFile = "Full path to text file" $OpenedTxtFile = FileOpen($TxtFile, 0) If $OpenedTxtFile = -1 Then MsgBox(48, "Error!", "File could not be opened. " & @CRLF _ & "1. Enter a valid path" & @CRLF _ & "2. Check if the file exists" & @CRLF _ & "3. Make sure you have access to the file" & @CRLF _ & "4. Check if the file is not opened by another program/script") Exit EndIf While 1 $Line = FileReadLine($OpenedTxtFile) If @error Then ExitLoop If StringInStr($Line, "BIOS") Then ;things you want do when matched $Found = "Yes" MsgBox(0, "Found!", $Line) ;other things you want do when matched EndIf WEnd ;Other code when finshed If $Found = "No" Then MsgBox(0, "Not found!", "AutoIt could not find the string you were searching for.") EndIf Link to comment Share on other sites More sharing options...
Doxie Posted October 29, 2004 Author Share Posted October 29, 2004 Thanks, By looking at your code, everything is starting to come back to me. Thanks mate... Were ever i lay my script is my home... 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