Sign in to follow this  
Followers 0
BALA

While-WEnd

6 posts in this topic




#2 ·  Posted (edited)

Is it possible to have two While-WEnd loops and if so how?

HotKeySet("{F3}", "NextWhile")
Global $trigger = 0

While 1
    While 1
        MsgBox(0, "Press F3", "Inside while loop.")
        If $trigger = 1 Then
            $trigger = 0
            ExitLoop
        EndIf
    WEnd
    MsgBox(0, "", "Outside while loop.")
WEnd

Func NextWhile()
    $trigger = 1
EndFunc   ;==>NextWhile
Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

well I meant something along the lines of two separate loops.

HotKeySet("{F3}", "NextWhile")
Global $trigger = 0

While 1
    MsgBox(0, "Press F3", "First loop.")
    If $trigger = 1 Then
        $trigger = 0
        ExitLoop
    EndIf
WEnd

While 1
    MsgBox(0, "", "Final loop.")
WEnd

Func NextWhile()
    $trigger = 1
EndFunc   ;==>NextWhile
...now if you say - I meant at the same time - I'll...........

Edit:........gently suggest reading about AdlibEnable

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

You need to end the while after either a specific number of times looped or until the action wanted is done, you can always go back to it later by using another loop

While $i <= 10
    MsgBox(0, "This will end after the count goes to 10", $i)
    $i = $i + 1
WEnd

While 1
    MsgBox(0, "This box will loop!", "This will Loop!")
WEnd

You can also set it up after a specific action is done, but check your help files for that.


-----------Current Programming Language Status:Beginner: J#, Ruby Intermediate: Autoit, Java, C#, C++Advanced: Basic, Visual Basic, Fortran

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