skaboy71 Posted February 27, 2004 Share Posted February 27, 2004 (edited) I am trying to nest while statements but I keep getting an error...I have 2 While's and 2 WEnd's ..... What am I doing wrong ???$rname = @MON&"-"&@MDAY&"-"&@YEAR&"_rep.txt" $report = FileOpen ( "C:\dreports\"&$rname, 1 ) $log = FileOpen ( "C:\logs\PMI-NTS-BDC02_app.txt", 0 ) If $log = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($log) If @error = -1 Then ExitLoop $done = 0 $linepts = StringSplit($line, " ") While 1 $compline = FileReadLine($report) If @error = -1 Then ExitLoop $clinepts = StringSplit($compline, " ") If $linepts[1] == $clinepts[1] AND $linepts[9] == $clinepts[9] Then $done = 1 EndIf WEnd If $done = 0 Then FileWriteLine($report,$line) WEnd FileClose($file) Edited February 27, 2004 by skaboy71 I'd rather laugh with the sinners than cry with the saints..... The sinners are much more fun....Only the good die young. -- Billy Joel Link to comment Share on other sites More sharing options...
Developers Jos Posted February 27, 2004 Developers Share Posted February 27, 2004 (edited) you are missing an endif $rname = @MON&"-"&@MDAY&"-"&@YEAR&"_rep.txt" $report = FileOpen( "C:\dreports\"&$rname, 1 ) $log = FileOpen( "C:\logs\PMI-NTS-BDC02_app.txt", 0 ) If $log = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($log) If @error = -1 Then ExitLoop $done = 0 $linepts = StringSplit($line, " ") While 1 $compline = FileReadLine($report) If @error = -1 Then ExitLoop $clinepts = StringSplit($compline, " ") If $linepts[1]== $clinepts[1] AND $linepts[9] == $clinepts[9] Then $done = 1 EndIf WEnd If $done = 0 Then FileWriteLine($report,$line) EndIF WEnd FileClose($file) Edited February 27, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
skaboy71 Posted February 27, 2004 Author Share Posted February 27, 2004 Dohhhhh !!!! Thanks !! I feeel Duuuuuumb :-) I'd rather laugh with the sinners than cry with the saints..... The sinners are much more fun....Only the good die young. -- Billy Joel Link to comment Share on other sites More sharing options...
GEOSoft Posted February 27, 2004 Share Posted February 27, 2004 for that one you could also just use If $done = 0 Then FileWriteLine($report,$line) Then no EndIf is required It cuts down the line count by 1 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...
Developers Jos Posted February 27, 2004 Developers Share Posted February 27, 2004 (edited) no.. its just a matter of making it visable by formatting your source.... ( a bit of promo here for the Tidy script ) this was the output after formatting it: $rname = @MON&"-"&@MDAY&"-"&@YEAR&"_rep.txt" $report = FileOpen( "C:\dreports\"&$rname, 1 ) $log = FileOpen( "C:\logs\PMI-NTS-BDC02_app.txt", 0 ) If $log = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($log) If @error = -1 Then ExitLoop $done = 0 $linepts = StringSplit($line, " ") While 1 $compline = FileReadLine($report) If @error = -1 Then ExitLoop $clinepts = StringSplit($compline, " ") If $linepts[1] == $clinepts[1] And $linepts[9] == $clinepts[9] Then $done = 1 EndIf Wend If $done = 0 Then FileWriteLine($report,$line) Wend FileClose($file) Edited February 27, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
CyberSlug Posted February 27, 2004 Share Posted February 27, 2004 Admittedly, the error message is misleading.Line 27 (File "D:\myTmp.txt"):WEndError: "Wend" statement with no matching "While" statement. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! 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