Jump to content

Do/Until question


Recommended Posts

I have a question relating to the Do/Until Function... if my code this:

$Pixel = PixelGetColor(1, 1)
                While 1
                  Sleep(15000)
                
                
                                Do
                                   $LPixel = $Pixel
                                   $Pixel = PixelGetColor(1, 1)
                                Until $Pixel <> $LPixel
                                     

                
                Send("{F4}")
                Sleep(3000)
                Exit

WEnd

what i want to get out of this is: i want it to wait for the color at 1, 1 to CHANGE, once its CHANGED, i want it to continue on and send f4 and exit the program... but when i run it it sleeps 15 seconds, sends f4, and exits....... it completely skips the Do/Until

any help would be fantabulous, thanks :P

Link to comment
Share on other sites

While 1
Sleep(15000)
$LPixel = PixelGetColor(1, 1)
Do
$Pixel = PixelGetColor(1, 1)
Until $Pixel <> $LPixel
Send("{F4}")
Sleep(3000)
Exit
WEnd

Just removed the variable assignment in your Do Until loop.

EDIT: Works now, i had to leave the LPixel inside my while loop... ill test for further detail, thanks a bunch Edited by UnknownWarrior
Link to comment
Share on other sites

EDIT: Works now, i had to leave the LPixel inside my while loop... ill test for further detail, thanks a bunch

It's good that it's working. In the future when you have something like that you should try throwing in a msgbox set to your variable inside the loop then you could see if it's hitting it or if the loop is set wrong.

Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]
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...