Jump to content

Repeating Step


 Share

Recommended Posts

I've made a GUI with an input box ( $Length ) with a maximum of 20.

I want to create a function that moves the mouse 1 pixel to the left when it can't find the color, if it can find the color it needs to click on that same spot.

It needs to repeat this step the many times the user filled in in the input box.

For example: if you need to have 10 things it needs to move the mouse until it finds the color, then it'll need to click there and then repeat the step for another 9 times.

This is my idea (begin):

Func CreateLeftRight()
    $MousePos = MouseGetPos ()
    $Color = 0x88C859
    Send ( "2" )
    PixelSearch( $MousePos[0], $MousePos[1], $MousePos[0], $MousePos[1], $Color, 18 )
    If @Error Then
        MouseMove ( $MousePos[0]+1, $MousePos[1], 1 )
        CreateLeftRight()
    Else

    EndIf
EndFunc

I don't know what to do :D

Link to comment
Share on other sites

Well,, I managed to continue it! but it doesn't stop...

Func CreateLeftRight()
    $MousePos = MouseGetPos ()
    $Color = 0x88C859
    $i = 1
    Send ( "2" )
    While $i <= $Length
        PixelSearch( $MousePos[0], $MousePos[1], $MousePos[0], $MousePos[1], $Color, 35 )
        If @Error Then
            MouseMove ( $MousePos[0]+1, $MousePos[1], 1 )
            CreateLeftRight()
        Else
            MouseClick ( "Left", $MousePos[0], $MousePos[1], 1, 1 )
        EndIf
    WEnd
EndFunc

Anyone??

Link to comment
Share on other sites

Func CreateLeftRight()
    $MousePos = MouseGetPos ()
    $Color = 0x88C859
    Send ( "2" )
    PixelSearch( $MousePos[0], $MousePos[1], $MousePos[0], $MousePos[1], $Color, 18 )
    If @Error Then
        MouseMove ( $MousePos[0]+1, $MousePos[1], 1 )
        CreateLeftRight()
    Else
        ExitLoop ; ???????
    EndIf
EndFunc

This :D

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...