It is currently September 29th, 2024, 9:38 pm

Hide meter if there is no text value?

General topics related to Rainmeter.
Bambouca
Posts: 5
Joined: March 10th, 2013, 12:19 pm

Hide meter if there is no text value?

Post by Bambouca »

Hi,

I made a webparser skin for acquiring MAC addresses of associated clients with my wireless router. It substitutes MAC address for real names of devices and shows it when the device is connected to my home wireless network.

So I have six meter groups for every device like this:

Code: Select all

[MeterClient1]
Meter=String
MeterStyle=Style
Text=Active Client 1:
Group=Client1

[MeterClient1Name]
MeasureName=MeasureActiveClient1
Meter=String
MeterStyle=StyleName
Text=%1
Group=Client1
But, when the device is not connected to the network, it just shows the text: "Active Client 1:". So if the MeterClientName meter is empty, I just want to hide that group. I tried with IfEqualValue, but it seems it works just with number values. I think there has to be simple solution for this problem, but I still cant find it.

Thanks
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Hide meter if there is no text value?

Post by jsmorley »

Code: Select all

[MACMeasure]
Measure=SomeMeasureType
Blah
RegExpSubstitute=1
Substitute=".*Active Client.*":"-1"

[MeasureTest]
Measure=Calc
Formula=[MeasureMAC]
IfBelowValue=0
IfBelowAction=[!HideMeter MeterOne][!UpdateMeter *][!Redraw]
IfEqualValue=0
IfEqualAction=[!ShowMeter MeterOne][!UpdateMeter *][!Redraw]
DynamicVariables=1
Any string returned from the measure that does NOT contain "Active Client" will be evaluated as "0" by the calc measure. Any string that does will be evaluated as "-1".

http://docs.rainmeter.net/manual-beta/measures/general-options/substitute
http://docs.rainmeter.net/manual-beta/measures/general-options/ifactions
Bambouca
Posts: 5
Joined: March 10th, 2013, 12:19 pm

Re: Hide meter if there is no text value?

Post by Bambouca »

Thank you, that's what I was searching for ;-)
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Hide meter if there is no text value?

Post by jsmorley »

Glad to help.