Jump to content
Sign in to follow this  
ink

error in loop

Recommended Posts

ink

im currently working on this script (Look Below) what i want it to do is that it will keep popin' the error message until i write the correct word but then i enter it the first time it come up with the error message hope you can help me Best Regards ink

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.4.4
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
Global $i = 1, $l = 10
Opt("MouseCoordMode", 2)
$i1 = InputBox("Question", "how many times do you want the mouse to move must be numbers")
$delay = InputBox("Question", "how much delay should there be between each mouse move?")
$option = InputBox("Question", "which way do you like to move the mouse there're too options down or left")

If $option = Not "down" or "left" Then
Do
    $error = MsgBox(4, "Warning", "you entered a wrong option" & @LF & "would you like to try again?")
If $error = 7 Then
    Exit
EndIf
    $option = InputBox("Question", "which way do you like to move the mouse there're too options down or left")
Until $option = "down" or $option = "left"
    EndIf
    $delay = $delay *1000
While $i <= $i1
    If $option = "down" Then
    MouseMove(20,20+$l)
ElseIf $option = "left" Then
    MouseMove(20+$l,20)
EndIf
                TrayTip("Information......", "moving the " & $i & " time", $delay)
            Sleep($delay)
        $l = $l + 50
    $i = $i + 1
wend

Share this post


Link to post
Share on other sites
evilertoaster

maybe something like so-

Global $i = 1, $l = 10
Opt("MouseCoordMode", 2)
$i1 = InputBox("Question", "how many times do you want the mouse to move must be numbers")
$delay = InputBox("Question", "how much delay should there be between each mouse move?")
While 1
    $option = InputBox("Question", "which way do you like to move the mouse there're too options down or left")
    if $option="down" or $option="left" then ExitLoop
    $error = MsgBox(4, "Warning", "you entered a wrong option" & @LF & "would you like to try again?")
    If $error = 7 Then 
        Exit
    EndIf       
Wend

$delay = $delay *1000
While $i <= $i1
    If $option = "down" Then
    MouseMove(20,20+$l)
ElseIf $option = "left" Then
    MouseMove(20+$l,20)
EndIf
                TrayTip("Information......", "moving the " & $i & " time", $delay)
            Sleep($delay)
        $l = $l + 50
    $i = $i + 1
wend

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  

×