Sign in to follow this  
Followers 0
kthuis

HELP: color pixel coordinates

2 posts in this topic

I want to let the script search on the screen for a pixel! But i dont know how to let the porgramme search on the screen and save the coordinates in a variable!

Code:

X = 200

$y = 200

$color = PixelGetColor ( $x , $y )

$var = pixelsearch($X-10,$Y-10,$X+20,$Y+20,$color)

MsgBox(0, "X and Y are:", $var[0] & "," & $var[1])

Code:

#z:: ; Win-Z hotkey

MouseGetPos, X, Y

; Move the cursor out of the way so that it doesn't block the pixel we want.

; Move the mouse slowly so that the game can keep up with it:

MouseMove, 0, 0, 3

PixelGetColor, color, %X%, %Y%

MouseMove, %X%, %Y%, 1 ; moving faster seems ok in this case

clipboard = %clipboard%`nX%X% Y%Y% Color = %color%

return

Code:

$color = 255

$var = pixelsearch(0,0,@DesktopWidth,@DesktopHeight,$color)

MsgBox(0, "X and Y are:", $var[0] & "," & $var[1])

mousemove($var[0],$var[1])

Can some1 help me how it exactly is?

Share this post


Link to post
Share on other sites



Your well on your way:

$ << is the start of a variable. With PixelSearch() it will return an Array(). So the variable is a bit different.

Regular variable: $x = PixelGetColor(100, 200), now $x << is a variable, but isn't an array. $x = PixelSearch(100, 200, 100, 200, 0x0000FF) << is practically the same, but returns an array.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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