AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Searching for more than one pixel color?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Someone that needs help
Guest





PostPosted: Fri Feb 18, 2005 11:24 pm    Post subject: Searching for more than one pixel color? Reply with quote

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 Surprised
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Fri Feb 18, 2005 11:39 pm    Post subject: Reply with quote

Possible: Yes.
Difficult: Definitely.
Fun as hell: Oh yeah.

Laughing

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
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5068
Location: imaginationland

PostPosted: Fri Feb 18, 2005 11:58 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
ranomore



Joined: 06 Nov 2004
Posts: 178
Location: Salt Lake City, UT

PostPosted: Sat Feb 19, 2005 5:45 am    Post subject: Reply with quote

Quote:
Possible: Yes.
Difficult: Definitely.
Fun as hell: Oh yeah.

Smile Cool
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
James
Guest





PostPosted: Mon Feb 21, 2005 1:51 pm    Post subject: ! ! Reply with quote

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

PostPosted: Mon Feb 21, 2005 6:31 pm    Post subject: Reply with quote

It's on my to-do list. Confused
Back to top
View user's profile Send private message
Invalid User



Joined: 14 Feb 2005
Posts: 442
Location: Texas, Usa

PostPosted: Mon Feb 21, 2005 8:14 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Mon Feb 21, 2005 8:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
Invalid User



Joined: 14 Feb 2005
Posts: 442
Location: Texas, Usa

PostPosted: Mon Feb 21, 2005 8:33 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Rajat



Joined: 28 Mar 2004
Posts: 1718

PostPosted: Mon Feb 21, 2005 8:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Mon Feb 21, 2005 8:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
Invalid User



Joined: 14 Feb 2005
Posts: 442
Location: Texas, Usa

PostPosted: Mon Feb 21, 2005 8:51 pm    Post subject: Reply with quote

Oh yeah attempting my concept Should be done it C++ but I wanna see if AHK can do it
_________________
my lame sig Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Dippy46



Joined: 06 Jul 2004
Posts: 171
Location: Manchester, England.

PostPosted: Tue Feb 22, 2005 7:47 am    Post subject: Finding Pixels Reply with quote

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
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Feb 22, 2005 5:19 pm    Post subject: Reply with quote

I dunno... it seems easier to let PixelSearch do the searching and then work with what you get...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group