yucatan Posted May 6, 2008 Posted May 6, 2008 hi when i have read a file i want to select/search to a word b.v. when i get this when i read the file hello=hello test=test autoit=autoit c++=c++ i want to make that he select only the test: so i want to select the secend word test because when i read it something is there standing something different is that a possebility with Select("test=******") i wanne read the ***** how i can do this
monoceres Posted May 6, 2008 Posted May 6, 2008 My approach: $fhandle=FileOpen("filename.txt",0) Do $line=FileReadLine($fhandle) If @error=-1 Then ExitLoop If StringInStr($line,"test=") Then MsgBox(0,"Result",StringTrimLeft($line,StringLen("test="))) EndIf Until False Broken link? PM me and I'll send you the file!
Zedna Posted May 6, 2008 Posted May 6, 2008 #include <file.au3> Dim $aRecords If Not _FileReadToArray("data.txt",$aRecords) Then MsgBox(4096,"Error", " Error reading TXT to Array error:" & @error) Exit EndIf For $x = 1 to $aRecords[0] $data = StringSplit($aRecords[$x], '=') If Not @error Then If $data[1] = 'test' Then Msgbox(0,'Record test',$data[2]) EndIf Next Resources UDF ResourcesEx UDF AutoIt Forum Search
yucatan Posted May 6, 2008 Author Posted May 6, 2008 My approach: $fhandle=FileOpen("filename.txt",0) Do $line=FileReadLine($fhandle) If @error=-1 Then ExitLoop If StringInStr($line,"test=") Then MsgBox(0,"Result",StringTrimLeft($line,StringLen("test="))) EndIf Until False when i run it i get a loop that dont stop.. i'm the value is right of the test= and the fileopen...
monoceres Posted May 6, 2008 Posted May 6, 2008 when i run it i get a loop that dont stop.. i'm the value is right of the test= and the fileopen...Works for me with this text file: hello=hello test=test autoit=autoit c++=c++ Broken link? PM me and I'll send you the file!
yucatan Posted May 6, 2008 Author Posted May 6, 2008 hi it works for me now only one problem but how do i set it in a $ i want not to show a msgbox but i just want to because in $value how do i do this?
monoceres Posted May 6, 2008 Posted May 6, 2008 hi it works for me now only one problem but how do i set it in a $i want not to show a msgbox but i just want to because in $value how do i do this?$value=StringTrimLeft($line,StringLen("test="))Instead of MsgBox() Broken link? PM me and I'll send you the file!
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