Jump to content

Pixelsearch mouseover click?


Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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 :"> :">

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

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.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...