Sign in to follow this  
Followers 0
Dracor

error in loop

3 posts in this topic

I am new at AutoIt 3 and made this script. The problem I am getting is a error in the loop.

When I run the script I get " 'WEnd' statement with no matching 'while' statement" message.

What am I doing wrong? :P

Sleep (5000)

HotKeySet("{F1}","stop")

while 1

$__a_ = MouseGetPos ()

$y = $__a_[0]

$x = $__a_[1]

if ( $y > 40 ) then

if ( $y < 70 ) then

if ( $x < 36 ) then

if ( $x > 65 ) then

chant2 ()

else

if ( $y > 40 ) then

if ( $y < 70 ) then

if ( $x < 65 ) then

if ( $x > 100 ) then

chant3 ()

else

chant1 ()

EndIf

WEnd

Func chant1 ()

Send ("45678901")

Sleep (8000)

EndFunc

Func chant2 ()

Send ("321")

Sleep (8000)

EndFunc

Func chant3 ()

Send ("23")

Sleep (8000)

EndFunc

Func stop ()

sleep (10000)

EndFunc

Share this post


Link to post
Share on other sites



You need to review the structure of If..EndIf

Sleep(5000)
HotKeySet("{F1}", "Stop")
While 1
    $__a_ = MouseGetPos()
    $y = $__a_[0]
    $x = $__a_[1]
    If ($y > 40) And ($x > 65) And ($y < 70) And ($x < 36) Then
        Chant2()
    ElseIf ($y > 40) And ($y < 70) And ($x < 65) And ($x > 100) Then
        Chant3()
    Else
        Chant1()
    EndIf
WEnd
Func Chant1()
    Send("45678901")
    Sleep(8000)
EndFunc  ;==>Chant1
Func Chant2()
    Send("321")
    Sleep(8000)
EndFunc  ;==>Chant2
Func Chant3()
    Send("23")
    Sleep(8000)
EndFunc  ;==>Chant3
Func Stop()
    Sleep(10000)
EndFunc  ;==>Stop

Share this post


Link to post
Share on other sites

thanxs it worked.

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