Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Mouse click on a specified color??


  • Please log in to reply
9 replies to this topic
Karen
  • Guests
  • Last active:
  • Joined: --
how do you type that into the script? i just read over some of the help file about targeting colors but it didnt show an example on how to do it. Like if i wanted the mouse to click on the color blue or red wherever it is on the screen??

Help IS GREATLY APPRECIATED. THANKS.

sswceltic
  • Members
  • 18 posts
  • Last active: Dec 04 2010 05:07 PM
  • Joined: 26 Mar 2010
I used this 'get pixel color' script to find what the color is
+z::  ; Control+Z hotkey.
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%
MsgBox The color at the current cursor position is %color%.
return

then placed it in this script to click on a color
z::
IfWinExist, Your Window Here ;insert the window name
WinActivate
PixelSearch, Px, Py, 90, 190, 1062, 621, 0x00004c, 0, Fast ; oxoooo4c is the pixel color fould from using the first script, insert yours there
if ErrorLevel
MsgBox, That color was not found in the specified region.
else
   click %Px%, %Py%
[/code]

Karen
  • Guests
  • Last active:
  • Joined: --
awesome thanks alot. but how do i make it so a window doesnt show up when the pixel isnt there.

this is what i have.


Loop

{
Sleep 8000
PixelSearch, Px, Py, -4, -4, 1032, 746, 0x253334, 0, Fast
if ErrorLevel
MsgBox, That color was not found in the specified region.
else
click %Px%, %Py%
}

Esc::ExitApp


this is for a game and i just want it to keep searching and clicking on that pixel every 8 seconds. i dont want the window to appear when the pixel isnt there. how do i type that?

Much Appreciation, :)

Karen
  • Guests
  • Last active:
  • Joined: --
nobody can help me out further :( ?

MasterFocus
  • Moderators
  • 4323 posts
  • Last active: Dec 28 2015 07:24 PM
  • Joined: 08 Apr 2009
Didn't you even try to figure it out by checking the documentation?
Do you know what ErrorLevel and MsgBox mean?
<!-- m -->http://www.autohotkey.com/docs/<!-- m -->

Karen
  • Guests
  • Last active:
  • Joined: --

Didn't you even try to figure it out by checking the documentation?
Do you know what ErrorLevel and MsgBox mean?
http://www.autohotkey.com/docs/


yes i also tried taking out that whole thing with the error level and the message box but it just clicked on the screen and not on the specified pixel... hmm i will try somthing else now.

Karen
  • Guests
  • Last active:
  • Joined: --
i got it figured out. i made it work the way i wanted it to. but there is something else i am curious about. is there a way instead of making it click the pixel every 8 seconds, is it possible that it would click when it sees the pixel visible in the window?

so there would be no sleep but what would i have to type to make it seek the pixel as soon as it comes to the screen?

Thank you for any replies/help. it is much appreciated.

Karen
  • Guests
  • Last active:
  • Joined: --
anybody get what i am talking about?

Damein
  • Members
  • 296 posts
  • Last active: Nov 17 2011 07:37 PM
  • Joined: 27 Aug 2009
You could have it constantly checking to see if its on the screen; IE:

z::
Loop
{
PixelSearch, x, y, 0, 0, %A_ScreenWidth%,%A_ScreenHeight% , 0xC68600, Fast
Click,%x%,%y%
}
Return
 ; Change the 0xC68600 to the color you want.
#x::ExitApp


Karen
  • Guests
  • Last active:
  • Joined: --
thank you very much sir.