Jump to content

Recommended Posts

Posted

How could I wait for some set pixels to match, then continue with my script?

While PixelGelColor($x1, $y1) <> PixelGetColor($x2, $y2)
  Sleep(100);prevent excess CPU usage
WEnd

;rest of script goes here

For 3 or more pixels, try something like:

While PixelGelColor($x1, $y1) <> PixelGetColor($x2, $y2) AND PixelGetColor($x1, $y1) <> PixelGetColor($x3, $y3);add as many additional tests as you need
  Sleep(100);prevent excess CPU usage
WEnd

;rest of script goes here

You could also make a function that takes in an array or coordinates and checks to see if all are the same color. Return 1 if they all match, and return 0 if they don't.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Posted (edited)

Larry, thank you for your help. I can't seem to put this together properly on my end though. Can you show me exactly how to write the code to look for pixel dec color(8388736) at mouse coordinates x52 y424, if not found after 45 seconds then execute another program.

Edited by firepopp
Posted

Larry, we are almost there and I really appreciate your quick responses.

What I am doing is first running a process that will loop 24/7. The successful process should only take 45 seconds to present the desired pixels. I am looking to see if the presence of certain pixel dec value(8388736) exist at mouse coordinates x52 y424 after the process has been initiated, and if not exist after 45 seconds, then I want another program to be run. If it does exist within 45 seconds then start the loop and timer again.

Can you continue to help me with baby steps just as you have. I am starting to see how this works but I need some more detailed examples just like your last post.

Thank you Larry.

Posted

Larry, this is very good instruction you are providing me with.

I want auto-it to first kick off the program/process and also start the timer at the same time. Then I want auto-it to look for the existence of the pixels at the defined mouse coordinates which are relative to the desktop. If at anytime within the 45 second window it finds the pixels then I will execute a write2log.exe. If those pixels are not present after 45 seconds from the time the program was initiated, then I will run alert.exe. No matter what, I will keep running this process around the clock, so I will need it to loop.

Is this how I do that. Will this code send the alert.exe if the pixels aren't present in 45 seconds or will the code just run alert.exe after the 45 second interval. Your ElseIf statement is where I will use a program that will record my successfull probe if the pixels exist. Am I on the right page with this?

Run("Probe.exe")

$timeHandle = TimerStart()

While 1

Sleep(100)

If TimerStop($timeHandle) > 45000 Then

Run("Alert.exe")----Assuming something broke in the process----

$timeHandle = TimerStart()

ElseIf PixelGetColor(52,424) = 8388736 Then

Run("write2log.exe")----Assuming everything must have gone well---

$timeHandle = TimerStart()

EndIf

Wend

Posted

Yes, this process should run as soon as it ends. I will need it to loop. When I included the probe.exe within the While statement, my computer spawned hundreds of instances. How can I run probe.exe with a timer counting up to 45 seconds and if there isn't an existence of the pixel then run alert.exe.

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
×
×
  • Create New...