It is currently April 5th, 2020, 3:48 am

How to join two Measure=Strings in IfAboveValue

Help with creating, editing & fixing problems with skins
gkmaz9
Posts: 50
Joined: August 26th, 2019, 10:42 am

How to join two Measure=Strings in IfAboveValue

Post by gkmaz9 »

I try to make something like this

'precondition'
[&MeasureScript1:GetColor('cur_rgb')] is an RGB value, which changes frequently.
[&MeasureScript2:GetColor('cur_rgb')] is an RGB value, which changes frequently.

'want'
1. If "Measure_RGB1 OR Measure_RGB2" Is Above 200, Skin hide "METER_A"
2. If "Both Measure_RGB1 and Measure_RGB2" is Below, Skin show "METER_A"

How can you combine the two meshers?

Code: Select all

[Measure_RGB1]
Measure=String
String=[&MeasureScript1:GetColor('cur_rgb')]
RegExpSubstitute=1
Substitute="(\w+),(\w+),(\w+)":"\2"
IfAboveValue=200
IfAboveAction=!Execute[!hideMeter "METER_A"][!Redraw]
IfBelowValue=199
IfBelowAction=!Execute[!ShowMeter "METER_A"][!Redraw]
IfMatchMode=1
RegExpSubstitute=1
DynamicVariables=1

[Measure_RGB2]
Measure=String
String=[&MeasureScript2:GetColor('cur_rgb')]
RegExpSubstitute=1
Substitute="(\w+),(\w+),(\w+)":"\2"
IfAboveValue=200
IfAboveAction=!Execute[!hideMeter "METER_A"][!Redraw]
IfBelowValue=199
IfBelowAction=!Execute[!ShowMeter "METER_A"][!Redraw]
IfMatchMode=1
RegExpSubstitute=1
DynamicVariables=1
User avatar
jsmorley
Developer
Posts: 20440
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to join two Measure=Strings in IfAboveValue

Post by jsmorley »

Code: Select all

[Measure_RGB1]
Measure=String
String=[&MeasureScript1:GetColor('cur_rgb')]
RegExpSubstitute=1
Substitute="(\w+),(\w+),(\w+)":"\2"
DynamicVariables=1

[Measure_RGB2]
Measure=String
String=[&MeasureScript2:GetColor('cur_rgb')]
RegExpSubstitute=1
Substitute="(\w+),(\w+),(\w+)":"\2"
DynamicVariables=1
IfCondition=(Measure_RGB1 > 200) || (Measure_RGB2 > 200)
IfTrueAction=[!HideMeter METER_A][!UpdateMeter METER_A][!Redraw]
IfFalseAction=[!ShowMeter METER_A][!UpdateMeter METER_A][!Redraw]
IfCondition2=(Measure_RGB1 <= 200) && (Measure_RGB2 <= 200)
IfTrueAction2=[!ShowMeter METER_A][!UpdateMeter METER_A][!Redraw]
IfFalseAction2=[!HideMeter METER_A][!UpdateMeter METER_A][!Redraw]
https://docs.rainmeter.net/manual/measures/general-options/ifconditions/

The new-hotness IfCondition pretty much replaces the old-and-busted IfAbove/IfBelow/IfEqual options.

(Test) && (Test) : AND
(Test) || (Test) : OR

I think I understand your "rules" correctly...

1) Don't use !Execute with actions, it has long been deprecated, and is not needed.
2) !Redraw by itself does absolutely nothing. Always use it with !UpdateMeter.
You really don't need the [!UpdateMeter METER_A][!Redraw] bit at all in this case, the meter will be hidden or shown during this skin update anyway.
User avatar
balala
Rainmeter Sage
Posts: 10054
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to join two Measure=Strings in IfAboveValue

Post by balala »

jsmorley wrote:
February 14th, 2020, 4:22 pm
You really don't need the [!UpdateMeter METER_A][!Redraw] bit at all in this case, the meter will be hidden or shown on the next skin update anyway.
In fact in such cases !UpdateMeter indeed doesn't make too much sens, but !Redraw does. When a meter is hidden / shown a redraw of the skin can help, to get the skin showing / hiding the meter immediately.
User avatar
jsmorley
Developer
Posts: 20440
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to join two Measure=Strings in IfAboveValue

Post by jsmorley »

balala wrote:
February 14th, 2020, 5:04 pm
In fact in such cases !UpdateMeter indeed doesn't make too much sens, but !Redraw does. When a meter is hidden / shown a redraw of the skin can help, to get the skin showing / hiding the meter immediately.
You are right... However, I'm not sure either is needed in this case. When the conditions change that trigger the hiding or showing of the meter, the skin will be redrawn in any case at the end of that same update cycle. Not one Update later, but right then.
gkmaz9
Posts: 50
Joined: August 26th, 2019, 10:42 am

Re: How to join two Measure=Strings in IfAboveValue

Post by gkmaz9 »

jsmorley wrote:
February 14th, 2020, 4:22 pm

Code: Select all

[Measure_RGB1]
Measure=String
String=[&MeasureScript1:GetColor('cur_rgb')]
RegExpSubstitute=1
Substitute="(\w+),(\w+),(\w+)":"\2"
DynamicVariables=1

[Measure_RGB2]
Measure=String
String=[&MeasureScript2:GetColor('cur_rgb')]
RegExpSubstitute=1
Substitute="(\w+),(\w+),(\w+)":"\2"
DynamicVariables=1
IfCondition=(Measure_RGB1 > 200) || (Measure_RGB2 > 200)
IfTrueAction=[!HideMeter METER_A][!UpdateMeter METER_A][!Redraw]
IfFalseAction=[!ShowMeter METER_A][!UpdateMeter METER_A][!Redraw]
IfCondition2=(Measure_RGB1 <= 200) && (Measure_RGB2 <= 200)
IfTrueAction2=[!ShowMeter METER_A][!UpdateMeter METER_A][!Redraw]
IfFalseAction2=[!HideMeter METER_A][!UpdateMeter METER_A][!Redraw]
https://docs.rainmeter.net/manual/measures/general-options/ifconditions/

The new-hotness IfCondition pretty much replaces the old-and-busted IfAbove/IfBelow/IfEqual options.

(Test) && (Test) : AND
(Test) || (Test) : OR

I think I understand your "rules" correctly...

1) Don't use !Execute with actions, it has long been deprecated, and is not needed.
2) !Redraw by itself does absolutely nothing. Always use it with !UpdateMeter.
You really don't need the [!UpdateMeter METER_A][!Redraw] bit at all in this case, the meter will be hidden or shown on the next skin update anyway.
It is perfect! Works fine.
I will not use '!Execute' now.
I also understood [!UpdateMeter METER_A][!Redraw]. I make a lot of applications, I don't know much about the basics.
Thank you for always helping with both the difficult and the basics. :D

I modified it slightly to suit my situation.

Code: Select all

IfCondition=(Measure_RGB3 > 200) || (Measure_RGB4 > 200)
IfTrueAction=[!hideMeter "AAA"][!Delay 7500][!ShowMeter "AAA"][!UpdateMeter "AAA"][!Redraw]
User avatar
balala
Rainmeter Sage
Posts: 10054
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to join two Measure=Strings in IfAboveValue

Post by balala »

jsmorley wrote:
February 14th, 2020, 5:06 pm
You are right... However, I'm not sure either is needed in this case. When the conditions change that trigger the hiding or showing of the meter, the skin will be redrawn in any case at the end of that same update cycle. Not one Update later, but right then.
Yep, true! In this case it really makes not too much sense.
User avatar
jsmorley
Developer
Posts: 20440
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to join two Measure=Strings in IfAboveValue

Post by jsmorley »

gkmaz9 wrote:
February 14th, 2020, 5:11 pm
Thank you for always helping with both the difficult and the basics. :D
Always glad to help.