leernest Posted June 17, 2004 Share Posted June 17, 2004 I wrote a script making a menu to select the options. I tried both the option script alone, no problem has found. After I embedded the scripts to a main menu script, problem found when I called the option 2. What's wrong ? ; V2.64 to V3.0.93 (Version 1.0.4) ; Converted with AutoItV2toV3 [Version 1.0.5] ; © Copyright 2004 J-Paul Mesnage. ;*********************************************************************** ; ; Description : This modification provides a menu to choose for date selection. ; q : to Exit ; 1 : Current date select ; 2 : Previous date select ; ;************************************************************************ do ; Check_date $MyOption = InputBox ( 'TESTING OF MENU', 'Select 1 for current date and 2 for previous date ! q for QUIT !!!' ) if $MyOption = "1" then MsgBox(0,"test","This is option 1") #include "a_test.AU3" elseif $MyOption = "2" then MsgBox(0,"test","This is option 2") #include "b_test.AU3" endif Until $MyOption = "q" or "1" or "2" exit ----------------------------------------------------------------------------- ; V2.64 to V3.0.93 (Version 1.0.4) ; Converted with AutoItV2toV3 [Version 1.0.5] ; © Copyright 2004 J-Paul Mesnage. ; ; Program a_test.au3 MsgBox(0,"Test","Call on option 1") Exit ---------------------------------------------------------------------------- ; V2.64 to V3.0.93 (Version 1.0.4) ; Converted with AutoItV2toV3 [Version 1.0.5] ; © Copyright 2004 J-Paul Mesnage. ; ; Program b_test.au3 #include <date.au3> $DateVar=_DateLastDay(@MDAY & "/" & @MON & "/" &@YEAR ,"/") MsgBox(0,"TEST", "Inside the b_test" &$DateVar) exit ;==================================================== ; ; Description: Returns the previous day's date ; Syntax: _DateLastDay( $DateIn, $Delimiter ) ; Parameter(s): $DateIn - Input date ; $Delimiter - Delimiter of Days, Month and Year ; Requirement(s): Date is in format DD/MM/YYYY, where "/" is a variable delimiter ; You need to include Date.au3 (#include <Date.au3>) ; Return Value(s): On Success - Returns the previous day's date ; On Failure - Returns 0 and sets @error = 1 ; Author(s): Giuseppe Criaco <gcriaco@quipo.it> ; ;==================================================== Func _DateLastDay($DATEIN, $DELIMITER) $ARRDATE = StringSplit($DATEIN, $DELIMITER) $DD = $ARRDATE[1] $MM = $ARRDATE[2] $YYYY = $ARRDATE[3] If $ARRDATE[0] <> 3 Then SetError(1) Return 0 Exit EndIf If _DateIsValidMonthNum ($MM) And _DateIsValidYear ($YYYY) Then If $DD > 1 Then;Day > 1 $DD = $DD - 1 ElseIf $MM > 1 Then;Month > 1 $MM = $MM - 1 Select Case $MM = 02 If _DateIsLeapYear($YYYY) = 1 Then $DD = 29 Else $DD = 28 EndIf Case $MM = 04 Or $MM = 06 Or $MM = 09 Or $MM = 11 $DD = 30 Case Else $DD = 31 EndSelect Else $DD = 31 $MM = 12 $YYYY = $YYYY - 1 EndIf Else SetError(1) Return 0 Exit EndIf $DD = StringFormat( "%02d", $DD) $MM = StringFormat( "%02d", $MM) $DATEOUT = $YYYY & "" & $MM & "" & $DD Return $DATEOUT EndFunc ;==>_DateLastDay Link to comment Share on other sites More sharing options...
Developers Jos Posted June 17, 2004 Developers Share Posted June 17, 2004 The reason for the " "Do" statement has no matching "Until" statement." error is that you have an #include<date.au3> inside and Do-Until loop. The date.au3 contains functions (func-endfunc) which cannot be inside a Do-Untill. Just move the #include<date.au3> statement to the top of your main program and comment it out in the b_test.au3. 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...
leernest Posted June 17, 2004 Author Share Posted June 17, 2004 Hi JdeB, I follow your suggestion and move the include statment into the main program and comment it on the b_test.au3, but the same error message still found. Any other suggestions ? Thanks ! Link to comment Share on other sites More sharing options...
Developers Jos Posted June 17, 2004 Developers Share Posted June 17, 2004 What is the error you get ? 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...
leernest Posted June 17, 2004 Author Share Posted June 17, 2004 The following error message shown: Line 21(File "C:\temp\b_test.au3"); Func _DateLastDay($DATEIN,$DELIMITER) Error:"Do statement has no matching "Until" statement. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 17, 2004 Developers Share Posted June 17, 2004 Same issue as you had with the #include <date> . You need to move all functions outside of the Do-Until loop. So move the whole Func _DateLastDay top the bottom of you main pgm to fix this issue. 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...
leernest Posted June 18, 2004 Author Share Posted June 18, 2004 Yup, it's ok right now after I moved all function outside the Do..Until loop. Thanks for your help ! 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