Jump to content

Recommended Posts

Guest Liquid8
Posted

Hi I would like to make a script that scans every pixel in a window for a certain color, if the color is found it clicks on it.

could someone please help me with the code ?

Guest Liquid8
Posted

ok , im not that skilled in these things...

if you have more time could you be more specific please?

thanx on forehand

Posted (edited)

$window = "windowname" ;put window name here

$color = 111111111 ;put color here

WinActivate($window)

WinWaitActive($window)

;sometimes it takes a second to activate it

$size = WinGetPos($window)

While 1

$spot = PixelSearch(0,0,$size[2],$size[3],$color) ;2 is width, 3 is height, i believe

if (@error=1) Then

MsgBox(0,"oh no","cant find color!") ;comment this line and the next out, and comment the continueloop, if you want it to just keep looping if it catn find it

Exit

;ContinueLoop

EndIf

;you might also want to move the mouse there first, it looks cooler

MouseClick("left",$spot[0],$spot[1])

WEnd

[code=auto:0]

..i think...

*EDIT* i hate things. too lazy to fix that or whatever... but that should work

Edited by Lemures

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