Sign in to follow this  
Followers 0
Vindicator209

Looping sequence

3 posts in this topic

#include <GuiConstants.au3>

GuiCreate("MyGUI", 192, 442,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Input_1 = GUICtrlCreateEdit("", 10, 10, 80, 20)
$Input_2 = GUICtrlCreateEdit("", 10, 40, 80, 20)
$Input_3 = GUICtrlCreateEdit("", 10, 70, 80, 20)
$Input_4 = GUICtrlCreateEdit("", 10, 100, 80, 20)
$Input_5 = GUICtrlCreateEdit("", 10, 130, 80, 20)
$Input_6 = GUICtrlCreateEdit("", 10, 160, 80, 20)
$Input_7 = GUICtrlCreateEdit("", 10, 190, 80, 20)
$Input_8 = GUICtrlCreateEdit("", 10, 220, 80, 20)
$Input_9 = GUICtrlCreateEdit("", 10, 250, 80, 20)
$Input_10 = GUICtrlCreateEdit("", 100, 10, 80, 20)
$Input_11 = GUICtrlCreateEdit("", 100, 40, 80, 20)
$Input_12 = GUICtrlCreateEdit("", 100, 70, 80, 20)
$Input_13 = GUICtrlCreateEdit("", 100, 100, 80, 20)
$Input_14 = GUICtrlCreateEdit("", 100, 130, 80, 20)
$Input_15 = GUICtrlCreateEdit("", 100, 160, 80, 20)
$Input_16 = GUICtrlCreateEdit("", 100, 190, 80, 20)
$Input_17 = GUICtrlCreateEdit("", 100, 220, 80, 20)
$Input_18 = GUICtrlCreateEdit("", 100, 250, 80, 20)
$Input_19 = GUICtrlCreateEdit("", 100, 280, 80, 20)
$Input_20 = GUICtrlCreateEdit("", 100, 310, 80, 20)
$Button_27 = GuiCtrlCreateButton("STUDY!", 10, 400, 170, 30)
GuiSetState()
While 1
$1=GUICtrlRead($Input_1)
$2=GUICtrlRead($Input_2)
$3=GUICtrlRead($Input_3)
$4=GUICtrlRead($Input_4)
$5=GUICtrlRead($Input_5)
$6=GUICtrlRead($Input_6)
$7=GUICtrlRead($Input_7)
$8=GUICtrlRead($Input_8)
$9=GUICtrlRead($Input_9)
$10=GUICtrlRead($Input_10)
$11=GUICtrlRead($Input_11)
$12=GUICtrlRead($Input_12)
$13=GUICtrlRead($Input_13)
$14=GUICtrlRead($Input_14)
$15=GUICtrlRead($Input_15)
$16=GUICtrlRead($Input_16)
$17=GUICtrlRead($Input_17)
$18=GUICtrlRead($Input_18)
$19=GUICtrlRead($Input_19)
$20=GUICtrlRead($Input_20)

    $msg = GuiGetMsg()
    Select
        
    Case $msg = $Button_27
$stop = 1
While $stop
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $1 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $1 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $2 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $2 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $3 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $3 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $4 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $4 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
;STOP
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $5 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $5 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $6 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $6 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $7 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $7 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $8 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $8 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $9 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $9 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $10 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $10 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $11 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $11 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $12 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $12 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $13 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $13 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $14 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $14 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $15 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $15 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $16 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $16 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $17 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $17 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $18 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $18 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $9 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $19 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Spelling", "Please type in the word " & $20 & " and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> $20 Then
            MsgBox(4096, "Error", "Try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too 
        EndIf
    EndIf
WEnd
;STOP
;STOP
$stop=InputBox("Start over","Again?")
WEnd
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;
    EndSelect
WEnd
Exit

I saw something similar to this but icouldnt find it..i tried using a while loop, but it kept tellin me it had no WEND...what can i do to tell it to repeat without being told?


[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Share this post


Link to post
Share on other sites



MethodZero, this code seems to work fine. Can you post the code that give you the error about the Wend not being present.


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

maybe...

#include <GuiConstants.au3>

Dim $Input_[21], $answer_[21]
$Input_[0] = 20
$answer_[0] = 20

Dim $Study = StringSplit("Work,play,toys,marbles,girls,running,standing,jumping,more girls,sleeping,camping,lots-a-girls,skiing,climbing,skating,biking,reading,scratching,my head,I-love-women", ",")

GUICreate("MyGUI", 192, 442, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$top = 10
For $p = 1 To 10
    $Input_[$p] = GUICtrlCreateEdit($Study[$p], 10, $top, 80, 20)
    $Input_[$p + 10] = GUICtrlCreateEdit($Study[$p + 10], 100, $top, 80, 20)
    $top = $top + 30
Next
$Button_27 = GUICtrlCreateButton("STUDY!", 10, 400, 170, 30)
GUISetState()

For $x = 1 To 20
    $answer_[$x] = GUICtrlRead($Input_[$x])
Next


While 1
    $msg = GUIGetMsg()
    Select
        
        Case $msg = $Button_27
            Check_Answers()
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
            ;;;
    EndSelect
WEnd

Func Check_Answers()
    $bLoop = 1
    While $bLoop <= 21
        $text = InputBox("Spelling #" & $bLoop, "Please type in the word " & $answer_[$bLoop] & " and click OK")
        If @error = 1 Then
            MsgBox(4096, "Error", "You pressed 'Cancel' - Start Over!", 2)
            ExitLoop
        Else
            ; They clicked OK, but did they type the right thing?
            If $text <> $answer_[$bLoop]Then
                MsgBox(4096, "Error", "Try again!", 2)
            Else
                MsgBox(4096, "GREAT!!!", "You spelt ti correctly!", 2) ; lol
                $bLoop = $bLoop + 1    ; Exit the loop - ExitLoop would have been an alternative too
            EndIf
        EndIf
    WEnd
EndFunc   ;==>Check_Answers

Exit

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0