Jump to content


PixelSearch in reverse?


  • Please log in to reply
6 replies to this topic

#1 SD2K

SD2K
  • Guests

Posted 17 August 2004 - 03:16 AM

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.

#2 Chris

Chris
  • Administrators
  • 10727 posts

Posted 17 August 2004 - 11:22 AM

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.

#3 SD2K

SD2K
  • Guests

Posted 21 August 2004 - 10:24 PM

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 :-(.

David

#4 Chris

Chris
  • Administrators
  • 10727 posts

Posted 22 August 2004 - 12:26 AM

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.

#5 Guests

  • Guests

Posted 22 August 2004 - 01:18 AM

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.

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 ;-) ) This should do the trick!

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!

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!!!

#6 Chris

Chris
  • Administrators
  • 10727 posts

Posted 22 August 2004 - 02:53 AM

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).

#7 Guests

  • Guests

Posted 22 August 2004 - 03:56 PM

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:

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)!! :D