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 

PixelSearch in reverse?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
SD2K
Guest





PostPosted: Tue Aug 17, 2004 4:16 am    Post subject: PixelSearch in reverse? Reply with quote

Chris,

Thanks for an awesome utility. I was wondering whether PixelSearch could be done in "reverse" mode, i.e. starting from the lower right corner of the rectangle and scanning to the upper left corner. Maybe add another parameter to the PixelSearch function (i.e. 1=default upperleft-to-lowerright, 2=lowerright-to-upperleft)?

Just a thought.

Thanks.
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Tue Aug 17, 2004 12:22 pm    Post subject: Reply with quote

Although I can see why that would be useful in rare cases, it doesn't seem common enough to justify adding another parameter to the already-long list of parameters for this command. Has anyone else ever felt a need for this? Note that you could create your own reverse-search subroutine that mirrors the functionality of PixelSearch. You could also search smaller subregions with PixelSearch to give precedence to the lower right quadrant.
Back to top
View user's profile Send private message Send e-mail
SD2K
Guest





PostPosted: Sat Aug 21, 2004 11:24 pm    Post subject: Reply with quote

Chris wrote:
Although I can see why that would be useful in rare cases, it doesn't seem common enough to justify adding another parameter


Chris,

Thanks for your reply. I'm currently using PixelSearch to find a yellow color for the Gaim icon in my system tray and then double-clicking it to show/remove the buddy list. However the yellow color of the tray icon could also be something else (i.e. the yellow in the mIRC tray icon, or even the Outlook Express new mail notification). Since the older tray icons are always on the right, that's why I suggested the reverse PixelSearch idea.

Along these lines, I tried to come up with a more "surefire" method of showing/hiding the Gaim buddy list window (i.e. using PostMessage or SendMessage), but I couldn't determine the right messages from Window Spy. I followed the docs on the Autohotkey web site but I couldn't find the right messages Sad.

David
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Sun Aug 22, 2004 1:26 am    Post subject: Reply with quote

Thanks for the explanation. It might be helpful to know that nearly all tray-icon based apps have a hidden main window that can be displayed with WinShow. Once displayed, you can usually access most of that app's functionality from its menus or buttons. Also, you might try running the app a second time, which sometimes causes its window to appear (it might even offer command line paramters to do certain things).

If that doesn't work, another thing you can try on Windows XP (but this is a longshot/crazy idea) is sending Win-B, which activates the system tray. Then send a series of {right}'s to get to the correct icon, then send {AppsKey} to open that icon's menu. If the menu in question has a unique shortcut key (underlined letter), you could press that key on each icon's menu until the correct window or function is activated.

Finally, a trick I use to uniquely identify images is to find two pixels that are likely to be unique for that icon. Then do a loop to find each occurrence of the first color. For each occurence, check if the second signature pixel occurs at the correct relative position to the first. If it does, you have a match.

Someone sent me the source code for an ImageSearch function which I hope to try out soon. Basically, it searches the entire screen for a particular image.

Edit: The suggested reverse-PixelSearch is now supported.


Last edited by Chris on Mon Jan 24, 2005 12:14 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Sun Aug 22, 2004 2:18 am    Post subject: Reply with quote

Chris wrote:
all tray-icon based apps have a hidden main window that can be displayed with WinShow. Once displayed, you can usually access most of that app's functionality from its menus or buttons. Also, you might try running the app a second time, which sometimes causes its window to appear (it might even offer command line paramters to do certain things).


Unfortunately Gaim doesn't seem to have one; when the buddy list is closed/hidden, the window class (gdkWindowToplevel, Gaim is a GTK+ app) is destroyed.

Chris wrote:
If that doesn't work, another thing you can try on Windows XP (but this is a longshot/crazy idea) is sending Win-B, which activates the system tray. Then send a series of {right}'s to get to the correct icon, then send {AppsKey} to open that icon's menu. If the menu in question has a unique shortcut key (underlined letter), you could press that key on each icon's menu until the correct window or function is activated.


Wow, this is a really good tip (I thought I had all the Windows shortcuts memorized Wink ) This should do the trick!

Chris wrote:
Finally, a trick I use to uniquely identify images is to find two pixels that are likely to be unique for that icon. Then do a loop to find each occurrence of the first color. For each occurence, check if the second signature pixel occurs at the correct relative position to the first. If it does, you have a match.


That's a very good idea as well, I'll try and implement this too!

Chris wrote:
Someone sent me the source code for an ImageSearch function which I hope to try out soon. Basically, it searches the entire screen for a particular image.


Now this would be an AWESOME addition to Autohotkey...keep us posted!

Thanks a lot for your quick responses and excellent suggestions!!!
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10464

PostPosted: Sun Aug 22, 2004 3:53 am    Post subject: Reply with quote

Quote:
when the buddy list is closed/hidden, the window class (gdkWindowToplevel, Gaim is a GTK+ app) is destroyed.

Just in case you didn't check this: By default, hidden windows are not detected. You have to do "DetectHiddenWindows on" for commands to see them (except WinShow, which always sees them).
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Sun Aug 22, 2004 4:56 pm    Post subject: Reply with quote

Chris wrote:
Just in case you didn't check this: By default, hidden windows are not detected. You have to do "DetectHiddenWindows on" for commands to see them (except WinShow, which always sees them).


Thanks for the help. I went back to Winspector and, while the buddy list window was indeed destroyed, I found a GaimWin class, monitored that and (by lots of trial and error) pulled out the right message:

Quote:

DetectHiddenWindows, on
PostMessage, 0x400, 0, 0x203, , ahk_class GaimWin


That hotkey both shows and hides the buddy list window!! The DetectHiddenWindows is definitely necessary though.

THANKS (again)!! Very Happy
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List 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