It is currently March 29th, 2024, 3:24 pm
Get help with creating, editing & fixing problems with skins
basileus
Posts: 4 Joined: April 26th, 2017, 6:51 am
Post
by basileus » April 26th, 2017, 6:59 am
I'm trying to make a RAM/swap bar meter which changes color depending upon the amount of RAM used. To that end, my code for coloring the bar works, but the code doing some calculations does not. The Rainmeter log reports syntax errors in both of these sections. It also says that there is a
Formula: Syntax error in key "MaxValue" in [SwapCalc] (Wisp\Ram\Ram.ini) . How do I do assign the
MaxValue for my
[SwapCalc] measure if this is not allowed? I don't want to assign it a static value.
Code: Select all
[SwapCalc]
Measure=Calc
Formula=([SwapMemory:] - [PhysicalMemory:])
MinValue=0
MaxValue=([SwapMemory:MaxValue] - [PhysicalMemory:MaxValue])
Substitute="k":"KB","M":"MB","G":"GB"
IfAboveValue=0
IfAboveAction=[!SetOption "SwapText" "Text" "%1"]
IfBelowValue=0
IfBelowAction=[!SetOption "SwapText" "Text" "0.0 KB"]
[CalcRamUsage]
Measure=Calc
Formula=([PhysicalMemory:%])
I'm doing this according to the docs for section variables - where have I gone wrong?
Thanks in advance!
Last edited by basileus on April 26th, 2017, 7:12 am, edited 3 times in total.
Brian
Developer
Posts: 2674 Joined: November 24th, 2011, 1:42 am
Location: Utah
Post
by Brian » April 26th, 2017, 7:03 am
Looks like you just need
DynamicVariables=1 .
https://docs.rainmeter.net/manual-beta/variables/#DynamicVariables
Code: Select all
[SwapCalc]
Measure=Calc
Formula=([SwapMemory:] - [PhysicalMemory:])
MinValue=0
MaxValue=([SwapMemory:MaxValue] - [PhysicalMemory:MaxValue])
Substitute="k":"KB","M":"MB","G":"GB"
IfAboveValue=0
IfAboveAction=[!SetOption "SwapText" "Text" "%1"]
IfBelowValue=0
IfBelowAction=[!SetOption "SwapText" "Text" "0.0 KB"]
DynamicVariables=1
[CalcRamUsage]
Measure=Calc
Formula=([PhysicalMemory:%])
DynamicVariables=1
-Brian
basileus
Posts: 4 Joined: April 26th, 2017, 6:51 am
Post
by basileus » April 26th, 2017, 7:10 am
Nope - Same errors with or without DynamicVariables=1 . Also, with DynamicVariables=1 , the Formula: Syntax error in key "MaxValue" in [SwapCalc] (Wisp\Ram\Ram.ini) error keeps repeating in the log.
Brian
Developer
Posts: 2674 Joined: November 24th, 2011, 1:42 am
Location: Utah
Post
by Brian » April 26th, 2017, 7:20 am
It's hard to say what the problem is without seeing the other measures involved (specifically the SwapMemory and PhysicalMemory measures).
I suspect there is either a typo in the .ini skin file, or the calculation is negative.
-Brian
basileus
Posts: 4 Joined: April 26th, 2017, 6:51 am
Post
by basileus » April 26th, 2017, 7:22 am
Brian wrote: It's hard to say what the problem is without seeing the other measures involved (specifically the SwapMemory and PhysicalMemory measures).
I suspect there is either a typo in the .ini skin file, or the calculation is negative.
-Brian
The
SwapMemory and
PhysicalMemory measures are the inbuilt ones.
basileus
Posts: 4 Joined: April 26th, 2017, 6:51 am
Post
by basileus » April 26th, 2017, 7:23 am
Turns out I didn't know that SwapMemory and PhysicalMemory aren't actually measures by themselves, just providers. Sorry for the trouble.
Brian
Developer
Posts: 2674 Joined: November 24th, 2011, 1:42 am
Location: Utah
Post
by Brian » April 26th, 2017, 7:27 am
No trouble at all.
Hopefully you have it all working now.
-Brian