It is currently April 25th, 2024, 5:16 am
Get help with creating, editing & fixing problems with skins
derari
Posts: 17 Joined: February 24th, 2011, 5:39 pm
Post
by derari » December 18th, 2018, 11:55 am
I have a RunCommand that returns a number as a string value, but I would like to format the value as a number in a string meter.
However, the formatting options have no effect. The meter shows the plain result of the measure.
Example below, how can I fix this?
Code: Select all
[Rainmeter]
Update=1000
OnRefreshAction=[!CommandMeasure measureL2Cache "Run"]
[Metadata]
Name=Test
[measureL2Cache]
; returns "1024"
Measure=Plugin
Plugin=RunCommand
Parameter=wmic path Win32_Processor get L2CacheSize /VALUE
State=Hide
OutputType=ANSI
RegExpSubstitute=1
Substitute=".*?=":"","#CRLF#":""
UpdateDivider=-1
[meterL2Cache]
;prints "1024 MB" instead of "1.0 MB"
Meter=String
W=200
MeasureName=measureL2Cache
Text=%1 MB
Scale=1024
NumOfDecimals=1
balala
Rainmeter Sage
Posts: 16168 Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania
Post
by balala » December 18th, 2018, 12:18 pm
derari wrote: ↑ December 18th, 2018, 11:55 am
However, the formatting options have no effect. The meter shows the plain result of the measure.
Example below, how can I fix this?
Add a Calc measure, which makes the needed conversion:
Code: Select all
[measureL2CacheNum]
Measure=Calc
Formula=[measureL2Cache]
DynamicVariables=1
Now use the value returned by this measure into the String meter:
Code: Select all
[meterL2Cache]
...
MeasureName=measureL2CacheNum
derari
Posts: 17 Joined: February 24th, 2011, 5:39 pm
Post
by derari » December 18th, 2018, 12:54 pm
Thanks! I tried a calc measure with "measureL2Cache + 0" but that used the RunCommand's result code. There should be a wiki for Frequently Occurring Problems.
balala
Rainmeter Sage
Posts: 16168 Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania
Post
by balala » December 18th, 2018, 1:41 pm
derari wrote: ↑ December 18th, 2018, 12:54 pm
There should be a wiki for Frequently Occurring Problems.
Yes, there is: this forum.
Did it work?
derari
Posts: 17 Joined: February 24th, 2011, 5:39 pm
Post
by derari » December 18th, 2018, 5:41 pm
Yes, your solution fixed it. Thanks again!
balala
Rainmeter Sage
Posts: 16168 Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania
Post
by balala » December 18th, 2018, 6:01 pm
You're welcome.