It is currently March 28th, 2024, 5:34 pm

Monitor a (part of) the website

General topics related to Rainmeter.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Monitor a (part of) the website

Post by balala »

Maybe better later, than never. I finally found a solution, but had to test it. But this one is not a solution using just simple Rainmeter code, I had to add a small lua script
So, if you're interested, here is what to do: first create a Change.lua file into the @Resources folder of your config and add the following content:

Code: Select all

function Initialize()
	GeoPrev = SKIN:GetMeasure('GeoMeasure'):GetValue()
end

function Update()
	Geo = SKIN:GetMeasure('GeoMeasure'):GetValue()
	GeoChange = Geo - GeoPrev
	SKIN:Bang('!SetVariable', 'GeoChange', GeoChange)
	GeoPrev = Geo
end
On first step, this file will read twice the value of the [GeoMeasure] measure (once in the Initialize() and once in the Update() function) and will add these values to the Geo and GeoPrev variables. Then will determine the difference of these variables and will return this difference to the skin, through the GeoChange variable. The skin will react to the sign of this returned value (immediately I tell how). When this is done, the value of the GeoPrev variable will be updated to the value of the Geo variable.
Now, if the returned GeoChange variable is positive, means that the value of the [GeoMeasure] measure grew, if it's negative, the value of the measure decreased. The last thing you have to do is to execute the appropriate actions (bangs) according to the sign of the returned variable: if this variable is positive, the playing of the wav file should start and the color of the [GeoMeter] meter should be set.
To do all this, first you have to add a Script and a Calc measure to the code of the skin. Add the followings:

Code: Select all

[MeasureLuaScript]
Measure=Script
ScriptFile=#@#Change.lua

[MeasureGeoChange]
Measure=Calc
Formula=#GeoChange#
IfCondition=(MeasureGeoChange>0)
IfTrueAction=[!SetOption GeoMeter FontColor "247,202,24,255"]
DynamicVariables=1
Then remove the FinishAction option of the [GeoMeasure] measure.
You don't need any more the [MeasureMax] and [Timer] measure. Remove them.
The only disadvantage of this modifications is that immediately after the refresh, the sound will start to play, you'll have to click to stop it. I hope you can live with this inconvenience.
SophieR
Posts: 16
Joined: January 2nd, 2017, 11:04 pm

Re: Monitor a (part of) the website

Post by SophieR »

balala wrote:The only disadvantage of this modifications is that immediately after the refresh, the sound will start to play, you'll have to click to stop it. I hope you can live with this inconvenience.
I think it will be ok. Thank you balala, you've been a great help. I really appreciate it! :thumbup: :bow:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Monitor a (part of) the website

Post by balala »

Glad to help.
Post Reply