Page 2 of 3

Re: Trying to show / hide base on content

Posted: September 16th, 2019, 2:31 pm
by jsmorley
nodiaque wrote: September 16th, 2019, 2:28 pm Hello,

I tried some logic like that in the past and it didn't worked, but I just tried with yours. Now, it shows 2 empty line
Show me the values in About / Skins.

Re: Trying to show / hide base on content

Posted: September 16th, 2019, 2:33 pm
by jsmorley
I'm seriously betting that the string values for these registry entries are not "numeric" when they are filled. So the number values are just always zero.

If so, something like this will work:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureProfile]
Measure=String
String=Some String

[MeasureRole]
Measure=String
String=Some Other String

[MeasureProfileRole]
Measure=String
String=[MeasureProfile];[MeasureRole]
IfMatch=.+;
IfMatchAction=[!ShowMeterGroup "Profile"][!HideMeterGroup "Role"]
IfMatch2=^;.+
IfMatchAction2=[!ShowMeterGroup "Role"][!HideMeterGroup "Profile"]
IfMatch3=^;$
IfMatchAction3=[!HideMeterGroup "Profile"][!HideMeterGroup "Role"]
DynamicVariables=1

[MeterProfile]
Meter=String
Group=Profile
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Profile

[MeterRole]
Meter=String
Group=Role
Y=0R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Role
Note that I'm concatenating those two string values together and separating them with a static ; character, so I can test what is on the left and right (or not) of the ; character.

IfMatch cannot compare the string value of two separate measures at once, as it only acts on the string value of the measure it is actually on, unlike IfCondition, with is explicitly "told" which measure value(s) to act on. That's why I create a third measure to concatenate the string values together.

The test(s) are more or less the same. I'm testing the "states" of:

MeasureProfile has a text value
MeasureProfile does not have a text value and MeasureRole has a text value
Both MeasureProfile and MeasureRole do not have text values

Once again, one and only one of these can be true.

1.jpg

Re: Trying to show / hide base on content

Posted: September 16th, 2019, 2:49 pm
by nodiaque
It is string since it's from the registry. 0 is the current value for the MeasureProfile while MeasureRole have a value. So it should show only the MeterRole with it's value. I tried match in the past, didn't work.

Re: Trying to show / hide base on content

Posted: September 16th, 2019, 2:51 pm
by nodiaque
Just tried again with the "new" method. Now, it show 0 and an empty string. But I understand why the empty line, it's because this is not there anymore:

[!SetOption meterLabelProfile Y 0r]

Which lower the line.

Re: Trying to show / hide base on content

Posted: September 16th, 2019, 2:54 pm
by jsmorley
So it's all working as you want now?

Re: Trying to show / hide base on content

Posted: September 16th, 2019, 2:57 pm
by nodiaque
With my update, I get now 0 as showed because the Registry Value exist, but is empty. This return 0. They are of type registry

Code: Select all

[MeasureProfileRole]
Measure=String
String=[MeasureProfile];[MeasureRole]
IfMatch=.+;
IfMatchAction=[!ShowMeterGroup "Profile"][!HideMeterGroup "Role"][!SetOption meterLabelProfile Y 25r][!SetOption meterLabelRole Y 0r]
IfMatch2=^;.+
IfMatchAction2=[!ShowMeterGroup "Role"][!HideMeterGroup "Profile"][!SetOption meterLabelProfile Y 0r][!SetOption meterLabelRole Y 25r]
IfMatch3=^;$
IfMatchAction3=[!HideMeterGroup "Profile"][!HideMeterGroup "Role"][!SetOption meterLabelProfile Y 0r][!SetOption meterLabelRole Y 0r]
Image

Re: Trying to show / hide base on content

Posted: September 16th, 2019, 2:58 pm
by jsmorley
nodiaque wrote: September 16th, 2019, 2:57 pm With my update, I get now 0 as showed because the Registry Value exist, but is empty. This return 0. They are of type registry

Code: Select all

[MeasureProfileRole]
Measure=String
String=[MeasureProfile];[MeasureRole]
IfMatch=.+;
IfMatchAction=[!ShowMeterGroup "Profile"][!HideMeterGroup "Role"][!SetOption meterLabelProfile Y 25r][!SetOption meterLabelRole Y 0r]
IfMatch2=^;.+
IfMatchAction2=[!ShowMeterGroup "Role"][!HideMeterGroup "Profile"][!SetOption meterLabelProfile Y 0r][!SetOption meterLabelRole Y 25r]
IfMatch3=^;$
IfMatchAction3=[!HideMeterGroup "Profile"][!HideMeterGroup "Role"][!SetOption meterLabelProfile Y 0r][!SetOption meterLabelRole Y 0r]
Image
So is that "yes" or "no" to my question?

Re: Trying to show / hide base on content

Posted: September 16th, 2019, 3:02 pm
by jsmorley
You need DynamicVariables=1 on the string measure with the IfMatch(s) on it.

Re: Trying to show / hide base on content

Posted: September 16th, 2019, 3:13 pm
by jsmorley
I think I see what is happening.

If the Registry measure does not find the entry at all, it returns "0" as both the number and string values. Our IfMatch(s) are looking for an empty string, and not a value of zero, so this is giving you trouble.

Try this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureProfile]
Measure=String
String=Some String

[MeasureRole]
Measure=String
String=Some Other String

[MeasureProfileRole]
Measure=String
String=[MeasureProfile];[MeasureRole]
RegExpSubstitute=1
Substitute="^0;0$":";","(.+);0$":"\1;","^0;(.+)":";\1"
IfMatch=.+;
IfMatchAction=[!ShowMeterGroup "Profile"][!HideMeterGroup "Role"]
IfMatch2=^;.+
IfMatchAction2=[!ShowMeterGroup "Role"][!HideMeterGroup "Profile"]
IfMatch3=^;$
IfMatchAction3=[!HideMeterGroup "Profile"][!HideMeterGroup "Role"]
DynamicVariables=1

[MeterProfile]
Meter=String
Group=Profile
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Profile

[MeterRole]
Meter=String
Group=Role
Y=0R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Role
That will replace any "0" only values in either measure with an empty string, allowing our IfMatch(s) to work as expected.

Re: Trying to show / hide base on content

Posted: September 16th, 2019, 3:21 pm
by nodiaque
Oh wow, that worked! Was trickier then I though, I'm not very good with reg expr. Thanks a lot! I bet you could optimize my overall skin with your skill!