Jump to content
Macro Express Forums

Firefx 'page loading' icon

Recommended Posts

The 'spinner' icon always used to be filled with red while a page is loading.




Just noticed that is no longer happening. What do others see please? Rebooted, no change.


Non-trivial issue for me; I base many macros on detecting those red pixels as an indication that the page is ready.



Terry, East Grinstead, UK

Link to comment
Share on other sites

You are experiencing the pain of scripting pixel-sniffing macros for Firefox. The User Interface changes from version to version.


Short of discovering (or developing!) an add-on that provides more reliable feedback on page loading status, you may need to switch strategies. Perhaps the text that reports loading progress in the lower left corner of the screen?




Link to comment
Share on other sites

I don't use the icon (it's not even displayed on my screen), but I have reloaded it via Customize so as to be able to answer your question. I get no red while it's spinning (but obviously don't know how many FF versions that's been true for).

I suspect I do something quite similar to you, but I use the X (Stop loading this page) instead of the spinning icon. I occasionally have to change the location or pixel colour, but the changes are isolated to a single macro. Here's the code I use, which works as of FF 14.0.1 - it's called FirefoxLoaded.

<IF NOT PROGRAM Option="\x01" Program="FIREFOX.EXE"/>
<IF VARIABLE Variable="%nTimeoutSecs%" Condition="\x00" Value="0" IgnoreCase="FALSE"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%nTimeoutSecs%" Value="120" _COMMENT="Default of 120 seconds before timeout"/>
<VARIABLE MODIFY INTEGER Option="\x02" Destination="%nTimeout%" Value1="%nTimeoutSecs%" Value2="4"/>
<COMMENT Value="Check background below X, wait until inactive"/>
<REPEAT START Start="1" Step="1" Count="%nTimeout%" Save="FALSE" _COMMENT="nTimeoutSecs x 4"/>
<WINDOW ACTIVATE Title="xFirefox" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/>
<GET PIXEL COLOR Option="\x01" Rel_To_Screen="FALSE" X="69" Y="58" Destination="%nPixel%" _COMMENT="11711149 8747885"/>
<IF VARIABLE Variable="%nPixel%" Condition="\x00" Value="11316393" IgnoreCase="FALSE"/>
<DELAY Flags="\x02" Time="250"/>
<IF VARIABLE Variable="%nPixel%" Condition="\x01" Value="11316393" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang3081{\\fonttbl{\\f0\\fnil\\fcharset0 Arial;}{\\f1\\fnil Tahoma;}}\r\n{\\colortbl ;\\red255\\green0\\blue0;}\r\n\\viewkind4\\uc1\\pard\\qc\\cf1\\b\\fs32 Firefox timed out\\cf0\\b0\\f1\\fs16 \r\n\\par }\r\n" Left="Center" Top="385" Width="278" Height="72" Monitor="2" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x01" Delay="3"/>
<DELAY Flags="\x01" Time="3"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\Software\\Professional Grade Macros\\PhtData\\FirefoxAfterLoadDelay" Destination="%nDelayExtra%"/>
<IF VARIABLE Variable="%nDelayExtra%" Condition="\x03" Value="0" IgnoreCase="FALSE"/>
<DELAY Flags="\x01" Time="%nDelayExtra%"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%nDelayExtra%" Value="0"/>
<WRITE REGISTRY VALUE Key="HKEY_CURRENT_USER\\Software\\Professional Grade Macros\\PhtData\\FirefoxAfterLoadDelay" Destination="%nDelayExtra%"/>

Link to comment
Share on other sites

Thanks both.


@Paul: I'm going to set aside some time to study your macro very carefully because it's plainly more robust than mine and I reckon I'll learn from the exercise.


Meanwhile I'll adapt it to my pixel position(s) and try it in practice. But I've so far been unable to find pixel colour 11316393 in that vicinity. Also, what does the comment '11711149 8747885' mean please? Two other pixel colours?


If you have time, could you take a look at my much simpler attempt using the spinning dots please. Can you see any major flaws?:


<COMMENT Value="FF layout critical. Watch out for version changes."/>
<DELAY Flags="\x02" Time="200" _COMMENT="To allow spinning to start."/>
<REPEAT UNTIL Variable="%StopColour%" Condition="\x00" Value="11974840" _COMMENT="Grey, after the black during loading. FF Theme: Default"/>
<GET PIXEL COLOR Option="\x01" Rel_To_Screen="FALSE" X="99" Y="61" Destination="%StopColour%"/>
<DELAY Flags="\x02" Time="50"/>
<DELAY Flags="\x01" Time="0.1"/>
<TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 StopColour\\f1  = \\f0 %StopColour%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>




Terry, East Grinstead, UK


Link to comment
Share on other sites

You need to activate the Firefox window within your repeat loop, otherwise most mouse clicks by you will prevent your macro from finishing!


My macro contains 2 additional capabilities:

- a timeout, so that if the page never completes loading, I still regain control after the specified timeout (default is 120 seconds); I can tell if the page timed out in the If test after the repeat loop.

- an additional delay for "difficult" pages, which I have, on occasion, found useful.


Note that my firefox window is called xFirefox (when I start the computer, I rename Firefox to xFirefox using Actual

Window manager, because ME has a long-standing bug and its Move Mouse to Tray icon doesn't work reliably for my tray which is displayed over 2 lines; as I always have Foobar2000 open in the tray, I need Firefox to start with a unique letter other than F).


The pixel colours 11711149 and 8747885 used to work in earlier versions of Firefox.

Link to comment
Share on other sites

  • 3 weeks later...

In a related matter, I find that for many public websites, the main cause for slowdowns are ads and ad servers, not the main web server or the main content itself.


I installed Adblock Plus and FlashBlock and they've significantly reduced the "slow loading" and "not loading properly" problems. If you're accessing a public site which runs ads, these two extensions could help make your scripts more reliable.




Link to comment
Share on other sites

Thanks lemming.


I did use AbBlock Plus for many months, but recently uninstalled it when I realised I didn't confidently understand how it works, especially how to customise it. Instead I'm currently using the intuitive method of simply editing my XP Hosts file.


I'll take a look at Flashblock



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.

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.


  • Create New...