It is currently September 17th, 2021, 12:31 pm

Store Min and Max variables from an existing skin

Help with creating, editing & fixing problems with skins
MatteoFlash
Posts: 23
Joined: June 26th, 2010, 8:11 am

Store Min and Max variables from an existing skin

Post by MatteoFlash »

Hi guys,

today I think about a thing. I have a Measure skin, in which I detect every temperatures.
I just want to extend my skin inserting a table (it's ok also if I have to insert the modifies into the same skin) with Minimum and Maximum values, checking the value detected by the sensor in the (already existing) skin.
Is it possible to check detected values? Something like this:

Value= ...
MinValue= 0
MaxValue= 0

if (Value > MaxValue) then MaxValue=Value
if (Value < MinValue) then MinValue=Value

My issue is to "take note"/memorize a value extracted from a measuring tool into a variable.. I'll tell the truth, I have not check yet into the forum, just wrote down the question because I was curious and I had less time to check, but as soon as I come back to my home, I'll search for informations, hoping to not disturb anyone! :)
User avatar
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

Re: Store Min and Max variables from an existing skin

Post by kenz0 »

Calc measure can store excess value in itself.
For example, the following is a simple example which always memorizes the maximum value of measure.

Code: Select all

[Net]
Measure=NetIn

[NetMax]
Measure=Calc
Formula=NetMax > Net ? NetMax : Net

[MeterNetMax]
Meter=STRING
MeasureName=NetMax
(This way can detect only the excess value by evaluating [NetMax] section recursively.)

Then, you can change maximum value dynamically using DynamicVariables as follows.

Code: Select all

[MeasureSomething]
Measure=...
MaxValue=[NetMax]
DynamicVariables=1
.
Image
MatteoFlash
Posts: 23
Joined: June 26th, 2010, 8:11 am

Re: Store Min and Max variables from an existing skin

Post by MatteoFlash »

Wow, as wonderful as direct formulas!

I just tried in my skins, but I had problems..

This is the measurement:

Code: Select all

[CPUTemp1]
Measure=Plugin
Plugin=Plugins\SpeedFanPlugin.dll
SpeedFanType=TEMPERATURE
SpeedFanNumber=6
MinValue=#MinValue#
MaxValue=#MaxValue#
This is the calc from your suggestion:

Code: Select all

[CpuTempMin1]
Measure=Calc
Formula=CpuTempMin1 < CpuTemp1 ? CpuTempMin1 : CpuTemp1

[CpuTempMax1]
Measure=Calc
Formula=CpuTempMax1 > CpuTemp1 ? CpuTempMax1 : CpuTemp1
Then I just called, into a string tool, "CpuTempMin1" as Measurename and it didn't work..

Code: Select all

[CpuTempMinShow1]
MeasureName=CpuTempMin1
Meter=String
Text="Min: %1°C"
(.....)
There are some problems in the passage of variables, because I get "0" as result of the calc. The same for the max one. Am I wrong with anything?
I tried also some SetVariable, but I had the same result.. This is something wrong at the root, I suppose, even if "CpuTemp1" is viewed in my skin, not for every calculated formulas you suggested me.

Thank you
User avatar
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

Re: Store Min and Max variables from an existing skin

Post by kenz0 »

A basic logic is not wrong. but Calc has a kind of peculiarity of always returning 0 at the start of skin. Therefore, the minimum value will always be stored as 0.

So you need a little bit of trick to solve this problem.
The following is the one example.

Code: Select all

[Variables]
m=>

[CpuTemp1]
Measure=Plugin
Plugin=Plugins\SpeedFanPlugin.dll
SpeedFanType=TEMPERATURE
SpeedFanNumber=6
MinValue=#MinValue#
MaxValue=#MaxValue#

[Switch]
Measure=Calc
Formula=0 < CpuTemp1 ? 1 : 0
IfAboveValue=0
IfAboveAction=!RainmeterSetVariable m <

[CpuTempMin1]
Measure=Calc
Formula=CpuTempMin1 #m# CpuTemp1 ? CpuTempMin1 : CpuTemp1
DynamicVariables=1

[CpuTempMax1]
Measure=Calc
Formula=CpuTempMax1 > CpuTemp1 ? CpuTempMax1 : CpuTemp1
And also, Note that case sensitivity.
Since "CPUTemp1" and "CpuTemp1" are not equal, you need to define each measure names with the same letter.
.
Image
MatteoFlash
Posts: 23
Joined: June 26th, 2010, 8:11 am

Re: Store Min and Max variables from an existing skin

Post by MatteoFlash »

As soon as i changed that case sensitive mistake, it worked fine with the maximum value, thanks for the tip!

Now I'm gonna trying to fix also the minimum one with your logical hint...
Tried! And it's working! Thanks a lot for this, using logical sentence will allow me to create every thing I think, it's just a creativity issue :D

This is a very good support from you kenz0!

I redirect you, if you want, to my next problem: http://rainmeter.net/forum/viewtopic.php?f=5&t=4564
Meanwhile, I did the same thing (discussed in the topic) in another skin and it works perfectly.. I hope I'll be able to implement the Page1/Page2 thing :)
MatteoFlash
Posts: 23
Joined: June 26th, 2010, 8:11 am

Re: Store Min and Max variables from an existing skin

Post by MatteoFlash »

I didn't find Forum Rules about doubleposting, so I hope to be right if I post another question here inside, if not, tell me with no problems :)

I finished my work about Min/Max, there is an issue concerning the SpeedFanPlugin (maybe): when I open some game application (which uses Direct3D) and then close the game, Rainmeter is all refreshed, so I have Min=Max= last value detected inside the game.. I'd like to have the correct Minimum value referring to the value before starting the game (and auto-refreshing Rainmeter). Do you know if it's possible?

Ah, I've just noticed another thing.. That values (Min=Max= last value detected inside the game) doesn't change even if I wait..
For example, I had 53/46/51/49°C at my cores, during game, and now, after 5 minutes, I have Minimum and Maximum values fixed to that values, even if actual values are 35/32/35/32°C. This thing will change just if I manual refresh the skin.