Jump to content
Sign in to follow this  
lasse46

Pixelsearch mouseover click?

Recommended Posts

lasse46

is it possible to script :

when i hold the mouse over a 0x9ECBFF it makes a mouseclick?

thanks for any help :P

Share this post


Link to post
Share on other sites
PsaltyDS

is it possible to script :

when i hold the mouse over a 0x9ECBFF it makes a mouseclick?

thanks for any help :P

You want a loop that continuously reads the mouse position with MouseGetPos(), reads the pixel color at that position with PixelGetColor(), and clicks on a match with MouseClick().

Give a shot and post your code if you need more help! :nuke:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Azu

while 1

$pos=mousegetpos()

if pixelgetcolor($pos[0],$pos[1])=10406911 then mouseclick("left",$pos[0],$pos[1],1,0)

sleep(10)

wend

Share this post


Link to post
Share on other sites
micor

10406911 is the decimal value for 0x9ECBFF.

Use windows calc in scientific mode.

Share this post


Link to post
Share on other sites
Paulie

10406911 is the decimal value for 0x9ECBFF.

Use windows calc in scientific mode.

or, you could say

$HexVaue = "0x"&StringTrimLeft(Hex($DecimalValue),2)

Share this post


Link to post
Share on other sites
SmOke_N

or, you could say

$HexVaue = "0x"&StringTrimLeft(Hex($DecimalValue),2)
oÝ÷ Ûú®¢×®;¬¶z-©z÷«ÊØb(v'ßË¥µ«-¯(§ÚyÈ©êÝyȦj[ììZºÚ"µÍÓÜ
    ÌÎNÔ^[ÛÛÜ[ÙIÌÎNËHÈÜ[Û[ÜÛY[ÛÛÜÂÓÜ
    ÌÎNÓ[ÝÙPÛÛÜ[ÙIÌÎNËHÈÜ[Û[ÜÛY[ÛÛÜÂÚ[HBIÌÍÜÜÈH[ÝÙQÙ]ÜÊ
BRY
^[Ù]ÛÛÜ ÌÍÜÜÖÌK   ÌÍÜÜÖÌWJHOHQPÐH[[ÝÙPÛXÚÊ    ][ÝÛY ][ÝË  ÌÍÜÜÖÌK   ÌÍÜÜÖÌWKK
BTÛY
L
BÑ[
Brackets around it and a double = for exact match will help here.

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.

Share this post


Link to post
Share on other sites
Paulie

Or just not make everything so difficult as trying to decipher decimal vs hex

;Opt('PixelCoordMode', 2) ; Optional for client coords
;Opt('MouseCoordMode', 2) ; Optional for client coords
While 1
    $pos = MouseGetPos()
    If (PixelGetColor($pos[0],$pos[1]) == 0x9ECBFF) Then MouseClick("left", $pos[0], $pos[1], 1, 0)
    Sleep(10)
WEnd
Brackets around it and a double = for exact match will help here.

How can that work

PixelGetColor returns decimal values, so comparing to hex can't work

PixelGetColor

Returns a pixel color according to x,y pixel coordinates.

PixelGetColor ( x , y )

Parameters

x x coordinate of pixel.

y y coordinate of pixel.

Return Value

Success: Returns decimal value of pixel's color.

Edited by Paulie

Share this post


Link to post
Share on other sites
SmOke_N

How can that work

PixelGetColor returns decimal values, so comparing to hex can't work

You should really search things or test them before you post such a thing... That's like saying that
MsgBox(64, 'Info', 0xFF0000)
Should show the hex value, and not the decimal... but if you run it, what do you get?

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.

Share this post


Link to post
Share on other sites
Paulie

You should really search things or test them before you post such a thing... That's like saying that

MsgBox(64, 'Info', 0xFF0000)
Should show the hex value, and not the decimal... but if you run it, what do you get?
lol, well thats news to me

thats one shortcut i didn't know about :">

sorry :"> :">

Share this post


Link to post
Share on other sites
lasse46

Thanks alot! but if i want 5 colors similar to 10406911.. how do i write then?

if pixelgetcolor($pos[0],$pos[1])=10406911, 5 then ???

Share this post


Link to post
Share on other sites
SmOke_N

Thanks alot! but if i want 5 colors similar to 10406911.. how do i write then?

if pixelgetcolor($pos[0],$pos[1])=10406911, 5 then ???

You would either put those 5 colors in an array and do a For/Next 1 to 5, or do 5 "If" statements if you are looking for exactly those colors.

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.

Share this post


Link to post
Share on other sites
PsaltyDS

Thanks alot! but if i want 5 colors similar to 10406911.. how do i write then?

if pixelgetcolor($pos[0],$pos[1])=10406911, 5 then ???

You would use PixelSearch() instead of PixelGetColor() if wanted shade variations (near matches). Check it out in the help file!

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
SmOke_N

Hi, won't the code I posted work? :S

It's not that it won't work Azu, just more work than neccessary, take a look at the example I posted as to why.

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.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.