It is currently March 28th, 2024, 12:32 pm

Monitor a (part of) the website

General topics related to Rainmeter.
SophieR
Posts: 16
Joined: January 2nd, 2017, 11:04 pm

Re: Monitor a (part of) the website

Post by SophieR »

Well, I haven't been able to test it out yet, as there was nothing going on today, but now it starts playing sound every time in (re)start the computer, which is a bit annoying... :(
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Monitor a (part of) the website

Post by balala »

SophieR wrote:now it starts playing sound every time in (re)start the computer, which is a bit annoying... :(
Not just when you restart the computer, but even when you load or refresh the skin. As I wrote:
balala wrote:If you apply this solution, when you refresh the skin, the sound will start playing. Stop it, clicking any of the [MeterGeoImage] or the [GeoMeter] meter. This is occurring because initially (before the [GeoMeasure] measure return the value) the value of [MeasureMax] measure is 0, but this will be increased once the [GeoMeasure] measure returns a not zero value.
After this, the sound will be played just when the value returned by the [GeoMeasure] measure, increase.
Suppressing this behavior isn't impossible, but the solution would be a bit weird. If you're interested, I'll post a solution a bit later.
SophieR
Posts: 16
Joined: January 2nd, 2017, 11:04 pm

Re: Monitor a (part of) the website

Post by SophieR »

Please do, I would love to have a solution.

Thank you! :thumbup:
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Monitor a (part of) the website

Post by balala »

SophieR wrote:Please do, I would love to have a solution.
You have to remove the OnChangeAction option of the [MeasureMax] measure. In this case, even if the measure changes, the sound won't play, because there is no PlayLoop bang to do so.
You also need a measure which applies the removed OnChangeAction option, a few seconds after the [GeoMeasure] gets the first not zero value. Add the following measure to your code:

Code: Select all

[Timer]
Measure=Calc
Formula=( Timer + 1 )
IfCondition=(Timer=2)
IfTrueAction=[!SetOption MeasureMax OnChangeAction "[PlayLoop chime.wav]"][!DisableMeasure "Timer"]
Disabled=1
When the skin is loaded (refreshed) this measure is disabled (due to its Disabled=1 option). When you'll enable the [Timer] measure, it'll start counting and when it reaches 2 (if the Update value in the [Rainmeter] section is 1000, this will happen two seconds later), it'll apply the OnChangeAction to the [MeasureMax] measure and will disable the [Timer] measure itself (you don't need anymore this measure, unless you're refreshing the skin).
You need to enable the [Timer] measure right after the [GeoMeasure] measure gets its first value. Do this adding the following option to the [GeoMeasure] measure: FinishAction=[!EnableMeasure "Timer"].
If later anytime the value returned by the [GeoMeasure] measure grows above the value of [MeasureMax], this last one will be updated with the new value, so according to applied OnChangeAction option, it'll start playing the appropriate sound file.
Please let me know if you can't handle all these.
SophieR
Posts: 16
Joined: January 2nd, 2017, 11:04 pm

Re: Monitor a (part of) the website

Post by SophieR »

A little bit confusing, but I think I got it. 8-) Can you please check if I have done this correctly. I had also applied different color to GeoMeter. Here is the latest code:

Code: Select all

[Rainmeter]
Update=1000

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

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

[GeoMeasure]
Measure=Plugin
Plugin=Webparser
URL=#GeoURL#
RegExp=(?siU)Total Records: <b>(.*)</b>
StringIndex=1
UpdateRate=60
FinishAction=[!EnableMeasure "Timer"]

[MeasureMax]
Measure=Calc
Formula=( Max ( GeoMeasure, MeasureMax ))

[Timer]
Measure=Calc
Formula=( Timer + 1 )
IfCondition=(Timer=2)
IfTrueAction=[!SetOption MeasureMax OnChangeAction "[!SetOption GeoMeter FontColor 247,202,24,255][PlayLoop chime.wav]"][!DisableMeasure "Timer"]
Disabled=1

[MeterGeoImage]
Meter=IMAGE
ImageName=geo.png
X=0
Y=0
W=35
H=35
LeftMouseUpAction=[PlayStop][!SetOption GeoMeter FontColor 255,255,255,255][#GeoURL#]
SolidColor=0,0,0,1

[GeoMeter]
Meter=String
MeasureName=GeoMeasure
X=262
Y=8
W=500
StringAlign=RIGHT
StringCase=UPPER
StringStyle=BOLD
FontColor=#FontColor#
FontSize=#FontHeight#
FontFace=#FontName#
AntiAlias=1
Text=Total Records: %1
LeftMouseUpAction=[PlayStop][!SetOption GeoMeter FontColor 255,255,255,255][#GeoURL#]
SolidColor=0,0,0,1
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Monitor a (part of) the website

Post by balala »

SophieR wrote:A little bit confusing, but I think I got it. 8-) Can you please check if I have done this correctly. I had also applied different color to GeoMeter. Here is the latest code:
Yeah, it seems to be correct, just one small problem: when you set a string value to an option, through the !SetOption bang, the value should be always included into quotation marks. Usually any string is a good idea to be included. The color codes, (as I said before), although contain three or four numbers, are strings. That's why I'd modify the LeftMouseUpAction options of the [MeterGeoImage] and [GeoMeter] meter to LeftMouseUpAction=[PlayStop][!SetOption GeoMeter FontColor [color=#FF0000]"[/color]255,255,255,255[color=#FF0000]"[/color]][[color=#FF0000]"[/color]#GeoURL#[color=#FF0000]"[/color]]. I also would modify the IfTrueAction option of the [Timer] measure to: IfTrueAction=[!SetOption MeasureMax OnChangeAction [color=#FF0000]"""[/color][!SetOption GeoMeter FontColor [color=#FF0000]"[/color]247,202,24,255[color=#FF0000]"[/color]][PlayLoop [color=#FF0000]"[/color]chime.wav[color=#FF0000]"[/color]][color=#FF0000]"""[/color]][!DisableMeasure "Timer"]. If you do so, you need the magic quotes (the triple quotation marks).
SophieR
Posts: 16
Joined: January 2nd, 2017, 11:04 pm

Re: Monitor a (part of) the website

Post by SophieR »

Thank you balala, you've been a great help. :thumbup:

However, there is still an issue:

The code works just fine, if after the refresh, number goes up only. The problem appears if the number first drops and then goes up, than there is no alarm.

Yesterday I was testing it out on Germany. The number first dropped by 50 and was later raised by 2 then another 2 ,5 and then 3 and there was no sound played in any case. Not sure what to do now... :confused:
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Monitor a (part of) the website

Post by balala »

SophieR wrote:The code works just fine, if after the refresh, number goes up only. The problem appears if the number first drops and then goes up, than there is no alarm.

Yesterday I was testing it out on Germany. The number first dropped by 50 and was later raised by 2 then another 2 ,5 and then 3 and there was no sound played in any case. Not sure what to do now... :confused:
This is caused by the following fact: the [MeasureMax] measure always returns the largest value achieved so far by the [GeoMeasure] measure. If the value of the [MeasureMax] measure changes, according to the OnChangeAction set by the IfTrueAction option of the [Timer] measure, the sound will start to play and the color of the string is changed. But if the value of the [GeoMeasure] measure first decreases, then it starts to increase again, without overcome the previous value of the [MeasureMax] measure, the [MeasureMax] measure won't change, so the sound won't be played and the color of the string won't be changed. These will happen only when the value of the [GeoMeasure] measure overcome the value of the [MeasureMax] measure.
There is no simple solution for this (at least as far as I can tell). In fact I couldn't find one yet. I'll try to, but I'm not sure at all, I will find one. Sorry...
SophieR
Posts: 16
Joined: January 2nd, 2017, 11:04 pm

Re: Monitor a (part of) the website

Post by SophieR »

Is there a way to reset [MeasureMax] at each change? This could probably solve the problem... :confused:
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Monitor a (part of) the website

Post by balala »

SophieR wrote:Is there a way to reset [MeasureMax] at each change?
I tried this, but didn't help. Tomorrow I'll try to find a way to achieve what you'd like.
Post Reply