Jump to content

Recommended Posts

Posted (edited)

While 1
Sleep(1000)
PixelSearch ($pos[0], $pos[1], $pos[0], $pos[1], 0xEEEEFF)
;If it does find the the white pixel, then the loop will continue.
If Not @error Then
ContinueLoop
;If PixelSearch does not find the white pixel it will execute the following.
ElseIf @error Then
Send("{ENTER}")
Sleep(1111)
MouseClick("left", 666, 58, 1)
Sleep(1111)
MouseClick("left", 652, 90, 1)
Sleep(500)
MouseClick("left", 247, 269, 1)
Sleep(500)
Send("{TAB}")
Send("11111111111")
Sleep(100)
Send("{ENTER}")
Sleep(110)
MouseClick("left", 330, 151, 2)

ExitLoop
EndIf
WEnd

I'm sure the code above matters in no way but I thought you MAY need to see what I am looping.

My question is, How would I pause this loop every so often to play another loop until it finishes, then continue pixelsearching with the above loop?

Edited by Bizzet
Posted

This?

While 1
    PixelSearch($pos[0], $pos[1], $pos[0], $pos[1], 0xEEEEFF)

    meaningful_function_name()

    ;If it does find the the white pixel, then the loop will continue.
    If Not @error Then
        ContinueLoop
        ;If PixelSearch does not find the white pixel it will execute the following.
    ElseIf @error Then
        Send("{ENTER}")
        Sleep(1111)
        MouseClick("left", 666, 58, 1)
        Sleep(1111)
        MouseClick("left", 652, 90, 1)
        Sleep(500)
        MouseClick("left", 247, 269, 1)
        Sleep(500)
        Send("{TAB}")
        Send("11111111111")
        Sleep(100)
        Send("{ENTER}")
        Sleep(110)
        MouseClick("left", 330, 151, 2)

        ExitLoop
    EndIf
WEnd

Func meaningful_function_name()
    While True
        ; useful statement
        ; useful statement
        ; useful statement
        ; useful statement
    WEnd
EndFunc

Posted

I think the while loop is flawed

If Not @error Then
ContinueLoop
;If PixelSearch does not find the white pixel it will execute the following.
ElseIf @error Then

That means that if the pixel is found, the loop will begin again without carrying out the mouseclick operations

you need to reverse your logic.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

This?

While 1
    PixelSearch($pos[0], $pos[1], $pos[0], $pos[1], 0xEEEEFF)

    meaningful_function_name()

    ;If it does find the the white pixel, then the loop will continue.
    If Not @error Then
        ContinueLoop
        ;If PixelSearch does not find the white pixel it will execute the following.
    ElseIf @error Then
        Send("{ENTER}")
        Sleep(1111)
        MouseClick("left", 666, 58, 1)
        Sleep(1111)
        MouseClick("left", 652, 90, 1)
        Sleep(500)
        MouseClick("left", 247, 269, 1)
        Sleep(500)
        Send("{TAB}")
        Send("11111111111")
        Sleep(100)
        Send("{ENTER}")
        Sleep(110)
        MouseClick("left", 330, 151, 2)

        ExitLoop
    EndIf
WEnd

Func meaningful_function_name()
    While True
        ; useful statement
        ; useful statement
        ; useful statement
        ; useful statement
    WEnd
EndFunc

The two functions can not be played at the same time.

Loop 2 (as I will name it for now) need to be played while Loop 1 is stopped.

When Function 2 Loop is done executing it's functions, I would like Loop 1 to continue.

Posted

I think the while loop is flawed

If Not @error Then
ContinueLoop
;If PixelSearch does not find the white pixel it will execute the following.
ElseIf @error Then

That means that if the pixel is found, the loop will begin again without carrying out the mouseclick operations

you need to reverse your logic.

No, it is right.

I want the mouseclicks to play when the white pixel disappears.

Posted

The two functions can not be played at the same time.

Loop 2 (as I will name it for now) need to be played while Loop 1 is stopped.

When Function 2 Loop is done executing it's functions, I would like Loop 1 to continue.

LaCastiglione code does just that, when the func returns, your main loop will continue.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

The two functions can not be played at the same time.

Loop 2 (as I will name it for now) need to be played while Loop 1 is stopped.

When Function 2 Loop is done executing it's functions, I would like Loop 1 to continue.

Well since you can't have two loops at once...
Posted (edited)

My current code is

While 1
Sleep(1000)
PixelSearch ($pos[0], $pos[1], $pos[0], $pos[1], 0xEEEEFF)

Restart()
;If it does find the the white pixel, then the loop will continue.
If Not @error Then
ContinueLoop
;If PixelSearch does not find the white pixel it will execute the following.
ElseIf @error Then
Send("{ENTER}")
Sleep(1111)
MouseClick("left", 666, 58, 1)
Sleep(1111)
MouseClick("left", 652, 90, 1)
Sleep(500)
MouseClick("left", 247, 269, 1)
Sleep(500)
Send("{TAB}")
Send("11111111111")
Sleep(100)
Send("{ENTER}")
Sleep(110)
MouseClick("left", 330, 151, 2)

ExitLoop
EndIf
WEnd

Func Restart()
While True
Sleep(5000)
While 1
Send("{ENTER}")
Sleep(1000)
Send("{ENTER}")
Sleep(222)
Send("{ALT}")
Sleep(750)
MouseClick("left", 655, 88, 2)
Sleep(111)
MouseClick("left", 779, 57, 2)
Sleep(500)
Send("Bizzer")
Sleep(100)
MouseClickDrag ("left", 396, 251, 674, 471)
WEnd
EndFunc

I get an error of "While has no matching Wend statement"

It says the error is on the line of the last "EndFunc"

I'm sort of lost on what to do because I thought I added "WEnd" ?

Edited by Bizzet
Posted

okay everything is working great except 1 problem.

I do not need to play Loop 2 every time it pixelsearches.

I would like it play only every 30 minutes.

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
  • Recently Browsing   0 members

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