Lesler Posted September 29, 2010 Share Posted September 29, 2010 Hello I have a big text file in which I must find a path. Fx S:\finnpower\1.5mm\12273\12273-10-02.cp S:\finnpower\1.5mm\12304\12304-02-03.cp S:\finnpower\1.5mm\12389\12389-01-01.cp S:\finnpower\1.5mm\12389\12389-01-02.cp S:\finnpower\1.5mm\12389\12389-01-03.cp S:\finnpower\1.5mm\12389\12389-02-01.cp S:\finnpower\1.5mm\12389\12389-02-02.cp S:\finnpower\1.5mm\12389\12389-02-03.cp If I am so looking for 12389-02-01 I want my program to Return S:\finnpower\1.5mm\12389\12389-02-01.cp Do any of you who have an idea of how it can be done. Excuse my bad english, google translate is not better. Thanks in advance Martin Link to comment Share on other sites More sharing options...
wakillon Posted September 29, 2010 Share Posted September 29, 2010 (edited) Try this #include <file.au3> Dim $aRecords If Not _FileReadToArray("bigtextfile.txt",$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] If StringInStr ( $aRecords[$x], '12389-02-01' ) <> 0 Then ConsoleWrite ( "$aRecords[" & $x & "] : " & $aRecords[$x] & @Crlf ) Next Edited September 29, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Lesler Posted September 29, 2010 Author Share Posted September 29, 2010 Thanks for your prompt response. Will you help me get the answer. I can not figure out how to get the reply S:\finnpower\1.5mm\12389\12389-02-01.cp To fx example, a MsgBox Thanks in advance Link to comment Share on other sites More sharing options...
wakillon Posted September 29, 2010 Share Posted September 29, 2010 Thanks for your prompt response. Will you help me get the answer. I can not figure out how to get the reply S:\finnpower\1.5mm\12389\12389-02-01.cp To fx example, a MsgBox Thanks in advance Like this ? #include <file.au3> Dim $aRecords If Not _FileReadToArray("bigtextfile.txt",$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] If StringInStr ( $aRecords[$x], '12389-02-01' ) <> 0 Then MsgBox ( 0, '', "$aRecords[" & $x & "] : " & $aRecords[$x] ) ExitLoop EndIf Next AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Lesler Posted September 29, 2010 Author Share Posted September 29, 2010 Lige præcis. Mange tak for hjælpen Link to comment Share on other sites More sharing options...
wakillon Posted September 29, 2010 Share Posted September 29, 2010 Lige præcis.Mange tak for hjælpen Glad to help you ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts 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