Page 1 of 4

Monitor a (part of) the website

Posted: January 2nd, 2017, 11:24 pm
by SophieR
Hi there,

I'm looking for a way to monitor a website, or a part of it, to be more precise. This link will get you to a website which shows all geocaches in a chosen country. In the top left you can see words "Total records" and a number beside it (currently is 878, but this can change any time). This is the number I would like to show on my desktop and if possible get some sort of alert every time the number changes.

Can this be done using rainmeter? :???:

Thanks for the help! :)

Re: Monitor a (part of) the website

Posted: January 3rd, 2017, 12:47 am
by mak_kawa
Use WebParser Measure. Maybe following code works for exmple.

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=192,192,192

[Variables]
GeoURL=https://www.geocaching.com/seek/nearest.aspx?country_id=207&as=1&ex=0&cFilter=9a79e6ce-3344-409c-bbe9-496530baf758&children=n

[GeoMeasure]
Measure=Webparser
URL=#GeoURL#
RegExp=(?siU)Total Records: <b>(.*)</b>
StringIndex=1
OnChangeAction=[!SetOption GeoMeasure OnChangeAction "[!SetOption GeoMeter FontColor 255,0,0]"]
UpdateRate=60

[GeoMeter]
Meter=String
MeasureName=GeoMeasure
W=120
Text=Total Number: %1
LeftMouseUpAction=[!SetOption GeoMeter FontColor 0,0,0][#GeoURL#]
This code monitors "Total Records" every 60 seconds. And if the number is changed, alerts by red text color. Mouse click changes back text color to black and opens the webpage.

Hope I don't misunderatand.

Re: Monitor a (part of) the website

Posted: January 3rd, 2017, 1:04 am
by SophieR
mak_kawa wrote:Use WebParser Measure. Maybe following code works for exmple.

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=192,192,192

[Variables]
GeoURL=https://www.geocaching.com/seek/nearest.aspx?country_id=207&as=1&ex=0&cFilter=9a79e6ce-3344-409c-bbe9-496530baf758&children=n

[GeoMeasure]
Measure=Webparser
URL=#GeoURL#
RegExp=(?siU)Total Records: <b>(.*)</b>
StringIndex=1
OnChangeAction=[!SetOption GeoMeasure OnChangeAction "[!SetOption GeoMeter FontColor 255,0,0]"]
UpdateRate=60

[GeoMeter]
Meter=String
MeasureName=GeoMeasure
W=120
Text=Total Number: %1
LeftMouseUpAction=[!SetOption GeoMeter FontColor 0,0,0][#GeoURL#]
This code monitors "Total Records" every 60 seconds. And if the number is changed, alerts by red text color. Mouse click changes back text color to black and opens the webpage.

Hope I don't misunderatand.
Yes, you understood correctly what I'm trying to achieve, but the code doesn't work. It just say's Total Number: %1

Re: Monitor a (part of) the website

Posted: January 3rd, 2017, 1:13 am
by SophieR
Oh, and I get the Error: Webparser is not valid in [GeoMeasure]

Re: Monitor a (part of) the website

Posted: January 3rd, 2017, 1:24 am
by mak_kawa
Hi SophieR.

Ah...weird. Above code says "Total Number: 879" on my desktop. Your Rainmeter version is 4.0.0? Any error on Rainmeter log?

If your Rainmeter is 3.X, try to change "Measure=Webparser" to

Code: Select all

Measure=Plugin
Plugin=Webparser

Re: Monitor a (part of) the website

Posted: January 3rd, 2017, 1:46 am
by SophieR
Yay, it works! Thank you mak_kawa! :D :thumbup:

Now I'm wondering if there is a way to play a sound alert, when the change happens?

Re: Monitor a (part of) the website

Posted: January 3rd, 2017, 2:09 am
by mak_kawa
First you have to prepare suitable sound (wav) file, for example "chime.wav". And modify following two lines as:

Code: Select all

OnChangeAction=[!SetOption GeoMeasure OnChangeAction "[!SetOption GeoMeter FontColor 255,0,0][PlayLoop chime.wav]"]

LeftMouseUpAction=[PlayStop][!SetOption GeoMeter FontColor 0,0,0][#GeoURL#]
This code keeps up playing chime.wav until mouse click.

Re: Monitor a (part of) the website

Posted: January 3rd, 2017, 2:31 am
by SophieR
Great, you are the best. Thanks for the help!

Is it OK if I put .wav file in the folder next to the .ini file? Or should I put it in the @resources folder instead?

I have one more issue with this. I changed some of the code, here is what I have now:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
GeoURL=https://www.geocaching.com/seek/nearest.aspx?country_id=207&as=1&ex=0&cFilter=9a79e6ce-3344-409c-bbe9-496530baf758&children=n

FontColor=255,255,255,255
FontName=Open Sans
FontHeight=11

[GeoMeasure]
Measure=Plugin
Plugin=Webparser
URL=#GeoURL#
RegExp=(?siU)Total Records: <b>(.*)</b>
StringIndex=1
OnChangeAction=[!SetOption GeoMeasure OnChangeAction "[!SetOption GeoMeter FontColor 255,0,0][PlayLoop chime.wav]"]
UpdateRate=60

[GeoMeter]
Meter=String
MeasureName=GeoMeasure
W=120
StringAlign=CENTER
FontColor=#FontColor#
FontSize=#FontHeight#
FontFace=#FontName#
AntiAlias=1
Text=Number of Geocaches: %1
LeftMouseUpAction=[PlayStop][!SetOption GeoMeter FontColor 0,0,0][#GeoURL#]

The issue is that a part of the text is hidden and I can't get it to show (see the attachment). How can I sort this out? I tried changing the width, but it doesn't work...
image.PNG

Re: Monitor a (part of) the website

Posted: January 3rd, 2017, 2:47 am
by eclectic-tech
When using StringAlign=Center, you should always set the X value to 1/2 your W value.
Try:

Code: Select all

[GeoMeter]
Meter=String
MeasureName=GeoMeasure
X=100
W=200
StringAlign=CENTER
FontColor=#FontColor#
FontSize=#FontHeight#
FontFace=#FontName#
AntiAlias=1
Text=Number of Geocaches: %1
LeftMouseUpAction=[PlayStop][!SetOption GeoMeter FontColor 0,0,0][#GeoURL#]
I usually add SolidColor=0,0,0,1 to any string meters that have mouse actions; this makes the entire meter react to the mouse and not just the letters. It is also a good habit to add DynamicWindowSize=1 to the [Rainmeter] section; this will expand the skin to automatically fit the contents.

Re: Monitor a (part of) the website

Posted: January 3rd, 2017, 2:54 am
by SophieR
Thanks for the tips eclectic-tech, altought I have been using Rainmeter for a while now, I'm still a noob when it comes to making changes... :D

I guess it's all sorted now, just have to wait for a number to change, to see if all works and plays as it should... :???: