Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate .
Advanced This topic
  • Search section:
.

Mouse click on a specified color??

Started by Karen , Aug 01 2010 12:25 AM

  • 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.
#1 - Posted 01 August 2010 - 12:25 AM
.
.

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]
#2 - Posted 01 August 2010 - 01:26 AM
.
.

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, :)
#3 - Posted 04 August 2010 - 09:32 PM
.
.

Karen
  • Guests
  • Last active:
  • Joined: --
.
nobody can help me out further :( ?
#4 - Posted 05 August 2010 - 01:36 AM
.
.

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 -->
#5 - Posted 05 August 2010 - 01:38 AM
.
.

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.
#6 - Posted 05 August 2010 - 01:45 AM
.
.

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.
#7 - Posted 05 August 2010 - 01:56 AM
.
.

Karen
  • Guests
  • Last active:
  • Joined: --
.
anybody get what i am talking about?
#8 - Posted 05 August 2010 - 02:12 AM
.
.

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

#9 - Posted 05 August 2010 - 02:21 AM
.
.

Karen
  • Guests
  • Last active:
  • Joined: --
.
thank you very much sir.
#10 - Posted 05 August 2010 - 02:56 AM
.
.

.

Reply to quoted posts     Clear    
  1. AutoHotkey Community
  2. AutoHotkey
  3. Ask for Help
  4. .
.

Sign In

Register now!
.
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%