Sign in to follow this  
Followers 0
Neato

Pixelsearch

5 posts in this topic

I want to check for an icon in systemtray. Look for the icon for about 10 mins. If the icon exsist then do something, if not, then continue with script. I tried the following, but it doesen't work.

$begin = TimerStart()

; sleep (5000)

Do

sleep (200)

$coord = PixelSearch( 728, 579, 735, 592, 0x00FFFF) ; Does not exsist.

Until NOT @error or TimerStop($begin) >=10000

If NOT TimerStop($begin) >=10000 then

MsgBox(4096, "Test", "TimerStop", 10) ; Icon never appears then continue with script.

Else

MsgBox(4096, "Test", "Pixelfound", 10)

MouseMove($coord[0], $coord[1])

;MouseClick("left")

EndIF

Thanks

Share this post


Link to post
Share on other sites



The code itself is valid, but you're only testing for 10 seconds. 1000 milliseconds is only 1 second, so the 10,000 milliseconds you test in your timer is much less than you want. Often, I will write out the math in my script so I can eaisily see when I make this error. To do this, just replace the number 10000 with 10 * 60 * 1000 for 10 minutes times 60 seconds per minute times 1000 milliseconds per second.


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

Share this post


Link to post
Share on other sites

Hi Pekster!

That part I know. I only test for 10 seconds, because it is a test. But do you have any input why my code is valid or even better, do you have a solution for my problem?

Share this post


Link to post
Share on other sites

Ah, just figured it out. When you see your message box that says "Timerstop", it actually did find your pixel. Your If statement reads "If the timer is not larger than 10 seconds, then tell the user the timer stopped" which is not what you want. Just remove the NOT there.


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

Share this post


Link to post
Share on other sites

Hi Pekster!

Wierd! :D I have tried that one too, but didn't get what I expected. Thanks.

Share this post


Link to post
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
Sign in to follow this  
Followers 0