Sign in to follow this  
Followers 0
Jmoore3274

Pixel Search help

3 posts in this topic

First off before I start I would like to express my absolute asstoundment in the support the Autoit community gives. I have been able to find everything I have needed to make a script as I think it up. This community seriously backs up its code. The only issues I have is with trying to make Pixel Search loop in a mannor I like. Please understand Im a complete noob and I hate asking for help. Below is my code which is simple and easy:

$coord = PixelSearch( 779, 172, 802, 192, 0xC11414, 10 )

If Not @error Then

MouseMove( 797,181 )

Sleep( 500 )

Send( "{CTRLDOWN}" )

MouseClick("Left" )

Sleep( 1000 )

Send( "{CTRLUP}" )

EndIf

This is what I'm trying to accomplish.

1) I would like Autoit to search an area specified for a certin color. If it dosen't find it then it will continue to search every 10 seconds. When it does find the color it will then execute the mouse movements and keystrokes and then loop, looking for the color and executeing everything again every 10 seconds.

2)Once the color is gone it will then reset and keep looking for the color again.

3)If the color isnt found then it will keep looking evey 10 seconds till the color is found.

Now I have looked all over the place for a answer or even a hint to direct me in the correct direction. I have found nothing that makes sence to me.

If any one can help I would greatly appriciate it. BTW if my spelling and grammar is bad Im sorry. I blame it on the liquor. It has been one of those late nights codeing and drinking :D

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

While 1
    Sleep(10000)
    $coord = PixelSearch(779, 172, 802, 192, 0xC11414, 10)
    If @error = 0 Then
;~      do stuff
    EndIf
WEnd

Not sure if I completely understood, but I think this will do what you want.

Edit: btw, Welcome to the Forum!

Edited by Hawkwing

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

Thanks for the help hawkwing. Looking at your code made me connect palm to face.

I can't believe I didn't figure that out on my own. Again thank you for the help.

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