 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
kbb101
Joined: 07 Oct 2007 Posts: 13
|
Posted: Sun Nov 18, 2007 9:30 pm Post subject: Color-coordinated clicking |
|
|
| Can someone help me out with color-coordinated clicking? I'm not exactly sure how to program it so it clicks on a certain color, like red. I already know how to get the color codes, so you can leave that out. |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1375
|
Posted: Sun Nov 18, 2007 9:43 pm Post subject: |
|
|
if you know that then whats the problem? scan the selected area for that colour pixel by pixel with
| Code: | | PixelGetColor, OutputVar, X, Y [, Alt|Slow|RGB] |
and then when one is the correct colour, then use the click command at that coordinate |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Nov 18, 2007 9:45 pm Post subject: |
|
|
| I was saying i knew how to get the color code as in 000000f. And what do you mean by that? Where would i plug in the color? |
|
| Back to top |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1375
|
Posted: Sun Nov 18, 2007 10:15 pm Post subject: |
|
|
| you need to read the help file. you obviously havent. it explains clearly what pixelgetcolor does and how to use it, and even has an example |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Mon Nov 19, 2007 1:10 am Post subject: |
|
|
are you trying to make it so clicks are ignored unless you click on Red, or trying to make the mouse find red and click on it?
Colors in AHK are in the form 0x______ (0x000000 through 0xFFFFFF) _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
kbb101
Joined: 07 Oct 2007 Posts: 13
|
Posted: Mon Nov 19, 2007 1:24 am Post subject: |
|
|
| im trying to make it find red, then click it. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Mon Nov 19, 2007 1:50 am Post subject: |
|
|
then use pixelsearch _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
kbb101
Joined: 07 Oct 2007 Posts: 13
|
Posted: Mon Nov 19, 2007 1:55 am Post subject: |
|
|
| Yeah, but how? I've read up on it, and i'm a little computer-stupid and don't understand it. Could you help me out? |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Mon Nov 19, 2007 2:00 am Post subject: |
|
|
change 1, 2, 3, 4 for your purposes
1 is X min of search area
2 is Y min
3 is X max
4 is y max
leave the other 3 alone.
| Code: |
color = 0x0000FF ;red
PixelSearch, Px, Py, 1, 2, 3, 4, %color%, 3, Fast
If not ErrorLevel
Click, %Px%, %Py%, left
|
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
kbb101
Joined: 07 Oct 2007 Posts: 13
|
Posted: Mon Nov 19, 2007 2:05 am Post subject: |
|
|
Uhm, I really don't udnerstand that, im sorry. So are you saying the minimum x,y cords it searchs and the max? Could you do something for me, just make one for me that works. The cords i need, or the place i need it to search within are the cords: 130,140-895,465 I need it to search within that window. I need it to find the standard color red, and thats all i really need it to do, i don't really understand the other stuff it asks for. Sorry for troubling you to explain yourself to an idiot, but I'd be helpful if you could help me out with this.
Also, when even I'm done with the PixelSearch command, would I just put click at the end? |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Mon Nov 19, 2007 4:22 pm Post subject: |
|
|
| Code: |
color = 0x0000FF ;red
PixelSearch, Px, Py, 130,140,895,465, %color%, 3, Fast
If not ErrorLevel
Click, %Px%, %Py%, left
|
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|