Jump to content
Macro Express Forums

Compare image instead of pixel color ?


Recommended Posts

When I want to see if a file changes I use HTTP Methods which you can do in an external script. The HTTP request will get you the whole file but there's a method that will only return the headers called "HEAD". The response headers usually have a "Last-Modified header. I just did one on my websites logo and I can see it was last modified on "Sun, 28 Feb 2021 00:24:18 GMT". I would cast that in the script to a decimal or longest-to-shortest text date format and compare. With this you can see if a file has changed without having to download it. 

If you don't want to do an external script, you could download the file and check it's metadata for a creation date tag. 

Link to comment
Share on other sites

Here's a macro to demonstrate. If I enter "http://bluepointdesign.com/images/logo.jpg" I can see these headers. Most of these can be useful. And I think the ETag header is essentially a version number. I know it's used on cache control so I think it's what you browser uses to decide if it needs to retrieve the file or if it can be loaded from cache. If so, you can use that to decide if the file, a graphic in this case, has changed. 

 

Content-Length: 37641
Content-Type: image/jpeg
Last-Modified: Sun, 28 Feb 2021 00:24:18 GMT
Accept-Ranges: bytes
ETag: "c5be40d68dd71:0"
Server: Microsoft-IIS/8.5
X-Powered-By: ASP.NET
X-Powered-By-Plesk: PleskWin
Date: Tue, 27 Apr 2021 17:44:01 GMT

HTTP Headers.mex

Link to comment
Share on other sites

Hello,

 

Sorry, took me a while to answer.

 

It's a very cool script !!

 

Unfortunately in my case, it's text that updates, and after a loading time that seems to be in jquery.

 

Here an example with the equivalent, some text which changes and I need to monitor a change, and the kind of jquery which adds a loading to the page: https://eu.tamrieltradecentre.com/pc/Trade/SearchResult?SearchType=Sell&ItemID=&ItemNamePattern=rusé&ItemCategory1ID=1&ItemCategory2ID=2&ItemCategory3ID=18&ItemTraitID=11&ItemQualityID=&IsChampionPoint=false&LevelMin=&LevelMax=&MasterWritVoucherMin=&MasterWritVoucherMax=&AmountMin=&AmountMax=&PriceMin=&PriceMax=&SortBy=LastSeen&Order=desc

 

I also have an other exemple if needed, but that's exactly the kind of page I need to monitor. 

 

But wait... Your script maybe works..? I'll try this :) that's a very cool one. Edit : not for the delay in jquery it seems. 

Link to comment
Share on other sites

You said "Image", not "Text". And image is a graphic file. Well that was a waste of my time. 

 

Everything is a request. Hit F12 on your keyboard and watch the requests in the network tab. If it's a GET you can get the web page with the HTTP GET command. Then simply compare the parts from the previous GET and see if it changes. However I see they use reCAPTCHA so that might not work. I use the method even to get the JSON data packages they scripts on the web page use. Often I can tweak the parameters to get all sorts of things they didn't intend.

 

I am guessing that after a period of time it automatically refreshes. There is text on the new page that is different than the pervious and you want to know when that occurs. Then simply do a CTRL+a and clipboard copy. All the visible text will be in there. The page you sent looks like this. 

 

Home
 Search
Addon 
Language 
Register
Login
TTC will not be able to afford everyday server costs without Ads. If you like TTC and wish to keep our servers running, please support us by disabling Ads blocker or by adding TTC into whitelist.

Thank you!
Our data is collected by community. If you like our site please consider helping us by installing our Addon and client.
Details
Search Result
rusé
Advanced Search
No trade matches your constraint
PayPal - The safer, easier way to pay online! 
About | Help | Contact us | Terms of Service | Privacy Policy
© 2015 by Steven Chen All rights reserved

Tamriel Trade Centre was created using content and materials from The Elder Scrolls® Online: Tamriel Unlimited™ © ZeniMax® Online Studios, LLC or its licensors. This site is not affiliated with ZeniMax Online Studios, and ZeniMax Online Studios is not responsible for any of the content on, or the privacy policy of this site.
Windows®, Xbox® and their logos are registered trademarks of Microsoft Corporation
Sony PlayStation® and its logo are registered trademarks of Sony Inc.

 

But I am unsure of what you are trying to do. 

 

Link to comment
Share on other sites

On 4/27/2021 at 6:29 PM, ikodan said:

I need to compare 2 pages in order to monitor the changes. 

 

I said that when you asked me what I wanted to do. The first question was about an image, because I planed to monitor the change in the page, with a "wait 5 sec" (recaptcha), and compare a picture of the page before and after. You asked me more precision when you tried to help me. 

 

In this exemple, I have to detect when there is a new item added in the page, but I can't copy paste all the page and compare, because there is timers on each item, "last seen 5 minutes ago", and the macro will detect a change that I don't need.  

 

Anyway thank you for your help... 

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