Jump to content

PixelSearch, Move Mouse to..


Recommended Posts

Hey guys ;)(and girls if any ^^)

I've started Playing around with PixelSearch, and after being shocked that it is not using X,Y i found it far smarter^^

For the Simple Version:

I need to PixelSearch the Screen for a Color. And Then Move the Mouse to that place.

Sleep(3000)
$Color = PixelSearch(0, 0, 1000, 1000, 0xE94434, 10)
If Not @error Then
    MouseClick("left", $Color,$Color)
Else
<- The Variable For the Mouse is also Not Working :) How can i move the Mouse to a Variable instead of Set Cordinates?

Advanced:

There is more than one Pixel of The Color.

And There will Most Likely Be More Than One Area With Them on the Screen, but the Mouse is only Supposed To Move to One Area with the Pixels.

So i think i will split the The Screen Into a Grid and Run the PixelSearch Function Until i Find One Window with The Color.

$Color = PixelSearch(0, 0, 100, 100, 0xE94434, 10)
If Not @error Then
Else

MORE ADVANCED !

I need the Script to "Understand 3d"

So i need to Calculate the Range between The Pixelsearch Window and the Center of The Screen.

Got any Help for me:) ?

Pieces of Script, Tutorials, articles ?

Thx for the Help ! :D

Link to comment
Share on other sites

In Autoit Help under PixelSearch:

Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y)

So you are Saying that:
$Color = PixelSearch(500, 300, 800, 600, 0x634f30, 10)
If Not @error Then
MouseClick("Right",$Color,1)
Else
MsgBox(0, "Error", "Error")
EndIf
???

Because That just Moves the Mouse to x= 0 y= 0 cordinates

Link to comment
Share on other sites

So you are Saying that:

$Color = PixelSearch(500, 300, 800, 600, 0x634f30, 10)
If Not @error Then
MouseClick("Right",$Color,1)
Else
MsgBox(0, "Error", "Error")
EndIf
???

Because That just Moves the Mouse to x= 0 y= 0 cordinates

Do you know how arrays work?

PixelSearch returns an array (Array[0] = x, Array[1] = y)

MouseClick syntax is MouseClick( "button" , x, y)

Comeon, this is pretty simple...

Edited by tomaskir
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

×
×
  • Create New...