Jump to content

Problems getting cycle to end


Recommended Posts

I am having a slight issue getting a While - Do cycle to end when the condition is met. Also i am having a problem getting a sound to play.

HotKeySet("{ESC}", "Terminate")
While 1
    Do
        sleep(3000)
        MouseClick("left", 103, 212)
        Sleep(3000)
        MouseClick("left", 187, 709)
        Sleep(3000)
     Until PixelGetColor (011, 704) <> 0xFFFFFF
  WEnd
  SoundPlay(@WindowsDir & "\Users\Office\Desktop\watch for new email\sound\Alarm.wav", 1)
Func Terminate()
   Exit 0
EndFunc

Basically it should click one location on the screen, wait, then click another location on the screen until the pixel at (11,704) is white, then stop clicking and play the sound file.

Currently it will click, wait, click, but when the conditions is met ( until pixel get color ) it just continues on clicking away like the pixel was never white.

I know the grid coords and the color are correct as i coded a pixel grid coords and color checker and have used it before with no issues.

Could anyone please help me find the missing period, comma, quote, whatever it is i missed or messed up.

Thanks a bunch.

Link to comment
Share on other sites

Move the SoundPlay statement before your WEnd.

 

Ok, done that, but it still neither stops when the pixel turns white, nor plays the sound. I have looked the code over a dozen times and cannot seem to find where i went wrong. For 15 short lines of code this is sure turning out to be a headache.

Link to comment
Share on other sites

There really are not any more details to be had, its an automated maual "find" search for a webmail client that receives a few thousand e-mails an hour.

The first click: clicks the next button to go to the next page

The second click click the up arrow on the firefox "find" bar (from when you hit ctrl+f)

The pixel get color checks the color of the find field text box, if the word is not found it is red, when the background turns white it means it found the search term

and once that is done it needs to stop.

Thats the best i can give you, i am not really looking for a better way to do it, my coding abilities are limited, and i am not one of those guys who is like "here, code this for me because i am lazy". I have code, it all appears to be right, but it is not working in the manner that the documentation of Autoit says it should work, so i am asking for someone to take a brief glance at 15 lines of code and tell me where i went wrong and why it is not stopping when the until pixelgetcolor condition is met, furthermore not playing the sound.

Thanks :)

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...