patgenn123 Posted October 19, 2009 Report Share Posted October 19, 2009 Since ME control functions do not work at times, I am forced to use pixels. Now I have captured a string of pixels unique for the control name. This is a string of pixels NOT a single pixel location. I saved the string in a text file and also have a macro run the area in which the string of pixels is located and save that into a separate text file. Now I want to run the macro and when the ENTIRE string is located, run a macro. How do you do this? You can't run a macro to search a middle pixel string because there are pixels of the same color all around and would not be able to distinguish. Is the best way to do this is to run the macro, find the string, and search for the middle location of the string and NOT the pixel? What does anyone suggest? Pat Quote Link to comment Share on other sites More sharing options...
rberq Posted October 22, 2009 Report Share Posted October 22, 2009 I have found it is not good to be overly precise with pixels. You might capture the pixel string today, and again tomorrow, and find tiny differences between them, or tiny differences from one computer to the next, which renders an exact comparison useless (even if we could figure out how to do it). IF you know approximately where the control is, here's something I have found to work on a number of windows: Set x-y coordinates in the "background" area of the window, above where the control is to be found (or to its right, or left, or below it). Find pixel color at the beginning point. Step one pixel position at a time toward the control. At each step, check whether pixel color has changed (indicating the boundary of the control). Step the coordinates by 5 or 10 or whatever to put you well within the control, rather than at its boundary. Click on it, or capture it, or whatever you want to do. I don't know if this helps you or not. Maybe you could provide a few more details of what type of control you are trying to locate, what application the window is for, and so on .... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.