Jump to content
Macro Express Forums

Puzzle over Firefox icon colour


Recommended Posts

I know there are other Firefox users here who employ the same simple method as me to detect when a page has loaded: checking the pixel colour at a certain position inside the 'Stop loading this page' icon, near the top left corner of the browser. (In my case the coordinates have been 118, 59 relative to window, for many months.)

 

I'm puzzling over why it stopped working this morning. I've had to adjust the Y coordinate from 59 to 61. It's got me baffled at the moment. I thought I could confidently rely on this routine, at least until Mozilla changed the version.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

And hence the problems with methods like these..............................................

And why I avoid them like the plague. For personal use it’s a pain, for a distributed macro it’s a nightmare. I have had to do it a few times before and when I do I set up routines to make sure the test itself will work. For instance I test the screen resolution, taskbar size, and any other graphical element possible. EG let’s say it’s a box on the status bar with a black border. I will first check to see that a pixel in the top, bottom, left, and right are all black effectively bracketing the button. If they are not where they’re supposed to be warn the user.

 

Now here’s another trick. I’ve written position learning macros for users. Let’s say the macro ran and failed like the above. I would ask the user if they can ‘show me’ the button with their mouse. Now scan left, right, top and bottom to find the new location and save that to the registry. Or just save the new position if you’re not into the bracket check. Or you can scan the entire display area looking for patterns but that’s a lot of work.

Link to comment
Share on other sites

Thanks Cory, some interesting ideas. But one difficulty I often have is that the pixel I'm testing is literally a single pixel, an 'island' in a sea of similar colours with quite different integer values. That's the case with this FF icon.

 

And I'd still like to know why that particular pixel appears to have moved 2 pixels!

 

--

Terry , East Grinstead, UK

Link to comment
Share on other sites

Fuzzy color match

................................................................................

...

When programmers change things, well, things change. Someone there probably decided to make a more pretty shading of the progress indicator or something. Again why I avoid GPC as a test.

 

One thing I discussed here and actually toyed with for a while is the ability to do a fuzzy color match. You see the pixel colors we get in MEP are decimal conversions of the hexadecimal color values. If one converts to Hex they are literally three values. EG green is 00FF00 (65280) or 00 (0 red), FF (255 green), and 00 (0 blue). But your problem is that it’s not pure green but green-ish for shading. So if we make our criteria fuzzy we can take the results from the Get Pixel Color and parse out the components and test individually. EG if red is less than 20, AND green is greater than 235, AND blue is less than 20 the color will be close to green. Of course I’m just making up those fuzzy tolerances but you get the picture.

 

BTW when I create a macro to do something like this I always do a screen/window shot and save it to file for later comparison. Warning, make sure to save it in a non-lossy file format or one that substitutes. IE don’t use JPEG for GIF. BMP is safest but is large. PNG offers GIF like lossless compression without the 256 color limit and resulting substitutions.

Link to comment
Share on other sites

  • 4 weeks later...

I'm sure you are aware of it, but for the benefit of others, an alternative method using colour detection is to make a custom throbber (top right of FF page). This requires some knowledge of Firefox, easily found by googling, and some basic graphic editing to create the throbber/s. The advantage is that you can make a large area of uniform colour for the "page loaded" condition. The larger target is less susceptible to variations in page geometry since the throbber is always at the right end of the menu bar and the colour is always what you made it.

Link to comment
Share on other sites

I'm sure you are aware of it, but for the benefit of others, an alternative method using colour detection is to make a custom throbber (top right of FF page). This requires some knowledge of Firefox, easily found by googling, and some basic graphic editing to create the throbber/s. The advantage is that you can make a large area of uniform colour for the "page loaded" condition. The larger target is less susceptible to variations in page geometry since the throbber is always at the right end of the menu bar and the colour is always what you made it.

 

Thanks John. Although my usual simple method has been working reliably again since that last time 3 weeks ago, I may well try that if it happens again, or even out of sheer curiosity.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...