| View previous topic :: View next topic |
| Author |
Message |
Someone that needs help Guest
|
Posted: Fri Feb 18, 2005 11:24 pm Post subject: Searching for more than one pixel color? |
|
|
Is it possible for AHK to search the screen ... meaning the whole screen, for 2 different pixel color's that are withing a certain distance from each other... if that makes sense?
need all the help i can get .
thanks
J  |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Fri Feb 18, 2005 11:39 pm Post subject: |
|
|
Possible: Yes.
Difficult: Definitely.
Fun as hell: Oh yeah.
I'm always up for a challenge. However, I'm kinda booked at the moment. If you can be patient, I can try to look at it sometime later tonight or tomorrow. |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Fri Feb 18, 2005 11:58 pm Post subject: |
|
|
Hi,
This may not be very well done but it's something I've just thought you could use and work-around:
| Code: | PixelSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, Colour1
If Colour1 = (your first colour)
{
PixelSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, Colour2
If Colour2 = (your seond colour)
MsgBox, Two Colours found!
else If Colour2 <> (your seond colour)
MsgBox, error. second colour not found.
}
else If Colour1 <> (your first colour)
MsgBox, error. first colour not found. |
See PixelSearch
Edit: you could also try to use the ErrorLevels for both pixelsearches and use expressions with IF/AND opeations to streamline the code a bit. |
|
| Back to top |
|
 |
ranomore
Joined: 06 Nov 2004 Posts: 178 Location: Salt Lake City, UT
|
Posted: Sat Feb 19, 2005 5:45 am Post subject: |
|
|
| Quote: | Possible: Yes.
Difficult: Definitely.
Fun as hell: Oh yeah. |
 |
|
| Back to top |
|
 |
James Guest
|
Posted: Mon Feb 21, 2005 1:51 pm Post subject: ! ! |
|
|
If anyone does come up with a script for what was described, i would be very happy =D i could use that,
Thanks
James |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Mon Feb 21, 2005 6:31 pm Post subject: |
|
|
It's on my to-do list.  |
|
| Back to top |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Mon Feb 21, 2005 8:14 pm Post subject: |
|
|
I think this Calls for A^2 + B^2 = C^2
When I think about it, it makes sense
A = Xcoord
B = Ycoord
and C = the distance from the known coords in pixels
Should I script the solution or is this enough? _________________ my lame sig  |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Mon Feb 21, 2005 8:30 pm Post subject: |
|
|
| I already know how to do it, I just haven't gotten around to it. Your solution is intriguing, though; my way would've simply been to compare the box for which the two pixels are opposite corners to a certain sized box, and if it was smaller, it was within range. |
|
| Back to top |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Mon Feb 21, 2005 8:33 pm Post subject: |
|
|
ah Ha, does yours compare a diagnal value?
Edit: and I blind or what?!
Edit2:I just came up with a really facinating Idea for a project regarding this, kinda like a math tool for triangls and squares Using the desktop as the drawing pad. hmm I wonder if it can even be done... _________________ my lame sig  |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1718
|
Posted: Mon Feb 21, 2005 8:44 pm Post subject: |
|
|
i've a half done script that searches for a 2x2 matrix of pixels... i started it after imagesearch didn't quite work for me. its lying untouched for past so many days, i'll try to finish it and post soon. _________________
 |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Mon Feb 21, 2005 8:45 pm Post subject: |
|
|
Many things that could be done in AutoHotkey could and should be done in a different language, for efficiency and ease of coding. Just a thought, since it seems like many people who like AHK want to do more with it, not realizing that what they're really getting excited about is programming in general.
Edit: This is a reply to IU, not Rajat. |
|
| Back to top |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Mon Feb 21, 2005 8:51 pm Post subject: |
|
|
Oh yeah attempting my concept Should be done it C++ but I wanna see if AHK can do it _________________ my lame sig  |
|
| Back to top |
|
 |
Dippy46
Joined: 06 Jul 2004 Posts: 171 Location: Manchester, England.
|
Posted: Tue Feb 22, 2005 7:47 am Post subject: Finding Pixels |
|
|
Interesting problem. I would suggest however using a divide and conquer approach. test an area first to find out if there are 2 pixels in this area, if not then dont bother with the maths, just move on. if there are 2 pix in the box check their distance. Not too sure about the the pythag bit cos either of 2 pixels could be the right answer @ 45 deg. blah blah
The thinking continues......... _________________ Simple ideas lie within reach, only of complex minds |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Tue Feb 22, 2005 5:19 pm Post subject: |
|
|
| I dunno... it seems easier to let PixelSearch do the searching and then work with what you get... |
|
| Back to top |
|
 |
|