Jump to content
Macro Express Forums

Changes to Chrome have broken my macro


Recommended Posts

I have gone back to using an older macro which I wrote to wait for a page to load in Chrome. It used the colour changes of the 'Reload' icon near the top left of the browser.


Unfortunately, it looks like Google in their infinite wisdom (sic!) have decided to change the behaviour of the reload icon. It used to only change to a darker grey before fully loading the page, then it would revert to a lighter grey/white colour.

The problem is, they seem to have changed its behaviour to now change to the darker grey as soon as you hover over it (which is what my test for change looked for while loading) this change has now broken my macro as it never returns to the 'loaded' state while the mouse cursor is hovering over it.


Does anyone have any suggestions?


Code below.



Variable Set Integer %nCheck% to 0
Get Mouse Position into (nXpos, nYpos) Relative to Current Window
Mouse Move: 81, 55 Relative to Current Window
Delay: 100 milliseconds
Repeat Until %nCheck% Equals "1"
Get Pixel Color at (82, 55) Relative to Current Window into %nPixelColour%
Delay: 100 milliseconds
Text Box Display:
If Variable %nPixelColour% Equals "14671839"
Variable Set Integer %nCheck% to 1
End If
End Repeat
Mouse Move: %nXpos%, %nYpos% Relative to Current Window


<VARIABLE SET INTEGER Option="\x00" Destination="%nCheck%" Value="0"/> <GET MOUSE POSITION Option="\x01" X="nXpos" Y="nYpos"/> <MOUSE MOVE Option="\x02" X="81" Y="55" _PROMPT="0x000A"/> <DELAY Flags="\x02" Time="100"/> <REPEAT UNTIL Variable="%nCheck%" Condition="\x00" Value="1"/> <GET PIXEL COLOR Option="\x01" Rel_To_Screen="FALSE" X="82" Y="55" Destination="%nPixelColour%"/> <DELAY Flags="\x02" Time="100"/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\f0\\fs16 %nPixelColour%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="109" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <IF VARIABLE Variable="%nPixelColour%" Condition="\x00" Value="14671839" IgnoreCase="FALSE"/> <VARIABLE SET INTEGER Option="\x00" Destination="%nCheck%" Value="1"/> <END IF/> <END REPEAT/> <MOUSE MOVE Option="\x02" X="%nXpos%" Y="%nYpos%" _PROMPT="0x000A"/>

Link to comment
Share on other sites

The symbol at the reload location changes to an X during the reload, and back to the circular-arrow when the reload is complete. If you check the pixel location of the center of the X, it should change from black to background color when the X goes away -- that is, when the page reload is complete. It's a small target to hit with your Get Pixel Color -- might be easier to check the arrowhead because that's a little bigger.

Link to comment
Share on other sites

When hovering the mouse pointer causes a colour change, I check the pixel colour at (x, y) rather than under the pointer.

Get Pixel Color at (100, 399) Relative to Current Window into %PixelColour%

The challenge is determining the colour when the act of hovering causes the colour to change. My workaround: take a screenshot, paste the screenshot into Paint, and use MEP's Mouse Locator tool to check the colour in Paint.

Link to comment
Share on other sites

Why don't you just get the pixel color at the location and leave the cursor someplace else?

 

Also what are you doing? I might be able to offer some tools to download pages for you as an external script and avoid all this.

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

×
×
  • Create New...