morgalis Posted May 5, 2009 Share Posted May 5, 2009 (edited) Select Case $msg = $OK_Btn $file = FileOpenDialog("test", @ScriptDir & "\", "test (*.xml)") ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($file) ;Check if user clicked on the "CANCEL" button Case $msg = $Cancel_Btn MsgBox(64, "New GUI", "You clicked on the Cancel button!") EndSelect why this gives me always first line of file ? should go though file till error event -1 raisses did reasearch so i used straight the sample from help file but same issue Edited May 5, 2009 by morgalis Link to comment Share on other sites More sharing options...
GEOSoft Posted May 5, 2009 Share Posted May 5, 2009 This works for me ; $file = FileOpen(FileOpenDialog("test", @ScriptDir & "\", "test (*.xml)"), 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($file) ; There might only be 1 ine in the file you are trying to read. Make sure you are not using wordwrap in the editor you're using. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
morgalis Posted May 5, 2009 Author Share Posted May 5, 2009 No , more then 1 lines are in the file <?xml version="1.0"?> <GlideProfile> <MinLevel>0</MinLevel> <MaxLevel>0</MaxLevel> <Factions>38 14 189 73</Factions> <LureMinutes>0</LureMinutes> <BlacklistOn>True</BlacklistOn> msg is always this <?xml version="1.0"?> Link to comment Share on other sites More sharing options...
GEOSoft Posted May 5, 2009 Share Posted May 5, 2009 Did you try the code as I posted it? George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
morgalis Posted May 5, 2009 Author Share Posted May 5, 2009 workx fileopen !!thnx Link to comment Share on other sites More sharing options...
wolf9228 Posted May 5, 2009 Share Posted May 5, 2009 Select Case $msg = $OK_Btn $file = FileOpenDialog("test", @ScriptDir & "\", "test (*.xml)") ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($file) ;Check if user clicked on the "CANCEL" button Case $msg = $Cancel_Btn MsgBox(64, "New GUI", "You clicked on the Cancel button!") EndSelect why this gives me always first line of file ? should go though file till error event -1 raisses did reasearch so i used straight the sample from help file but same issue FileOpenDialog Success: Returns the full path of the file(s) chosen. Results for multiple selections are "Directory|file1|file2|..." Failure: Sets @error to 1. $OK_Btn = 1 $Cancel_Btn = 0 $msg = 1 Select Case $msg = $OK_Btn $file = FileOpenDialog("test", @ScriptDir & "\", "test (*.xml)") ; Check if file opened for reading OK If @error Then MsgBox(0, "Error", "Unable to open file.") Exit Else $file = FileOpen($file, 0) ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend FileClose($file) EndIf ;Check if user clicked on the "CANCEL" button Case $msg = $Cancel_Btn MsgBox(64, "New GUI", "You clicked on the Cancel button!") EndSelectoÝ÷ ØäZºÚ"µÍÌÍÓÒ×ÐHBBIÌÍÐØ[Ù[ÐHBIÌÍÛÙÈHBBTÙ[XÝBBPØÙH ÌÍÛÙÈH ÌÍÓÒ×Ð ÌÍÙ[HH[SÜ[X[ÙÊ ][ÝÝÝ ][ÝËØÜ [È ][ÝÉÌLÉ][ÝË ][ÝÝÝ [ I][ÝÊHÈÚXÚÈY[HÜ[YÜXY[ÈÒÂYÜ[ÙÐÞ ][ÝÑÜ][ÝË ][ÝÕ[XHÈÜ[[K][ÝÊB^][ÙBÈXY[[ÈÙ^[[HSÑÈXXÚY ÌÍÙ[HH[SÜ[ ÌÍÙ[K B ÌÍØÚÈH[TXY ÌÍÙ[JBBBBSÙÐÞ ][ÝÐÚXY][ÝË ÌÍØÚÊB[PÛÜÙJ ÌÍÙ[JB[YÐÚXÚÈYÙÛXÚÙYÛH ][ÝÐÐSÑS ][ÝÈ]ÛØÙH ÌÍÛÙÈH ÌÍÐØ[Ù[ÐÙÐÞ ][ÝÓ]ÈÕRI][ÝË ][ÝÖ[ÝHÛXÚÙYÛHØ[Ù[]ÛÌÌÎÉ][ÝÊB[Ù[XÝ صرح السماء كان هنا 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