It is currently April 26th, 2024, 9:15 pm

How to apply Substitute\3 to IfCondition

Get help with creating, editing & fixing problems with skins
gkmaz9
Posts: 67
Joined: August 26th, 2019, 10:42 am

How to apply Substitute\3 to IfCondition

Post by gkmaz9 »

&MeasureScript8:GetColor is rgb value(ex.254,165,20)
I want to apply Substitute\3(Blue value) to IfCondition
However, IfCondition applies Substitute\1(red value)

In the current situation, [MeterForCheck] records 20 (Blue), but it outputs True.
(IfCondition= Measure_RGB8> 200)
Because it was calculated by the first value, red(254).

What went wrong?
How can Substitute\3 be applied to IfCondition?



Code: Select all

[Measure_RGB8]
Measure=String
String=[&MeasureScript8:GetColor('cur_rgb')]
RegExpSubstitute=1
Substitute="(\w+),(\w+),(\w+)":"\3"
IfCondition= Measure_RGB8 > 200
IfTrueAction=[!SetOption MeterForCheck2 Text "Ture"]
IfFalseAction=[!SetOption MeterForCheck2 Text "False"]
DynamicVariables=1

[MeterForCheck]
meter=String
MeasureName=Measure_RGB8
Text=%1
SolidColor=255,255,255,50
AntiAlias=1
ClipString=2
UpdateDivider = 1
DynamicVariables = 1
X=30
Y=0
W=100

[MeterForCheck2]
meter=String
MeasureName=Measure_RGB8
Text=%1
SolidColor=255,255,255,50
AntiAlias=1
ClipString=2
UpdateDivider = 1
DynamicVariables = 1
X=30
Y=20
W=100


mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: How to apply Substitute\3 to IfCondition

Post by mak_kawa »

Hi gkmaz9

I have replaced the RGB value to your RGB example (254,165,20), and your substitution and IfCondition worked well (= displays "True").

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=128,128,128,192

[Measure_RGB8]
Measure=String
String=254,165,20
RegExpSubstitute=1
Substitute="(\w+),(\w+),(\w+)":"\3"
IfCondition= Measure_RGB8 > 200
IfTrueAction=[!SetOption meterResult Text "True"]
IfFalseAction=[!SetOption meterResult Text "False"]
DynamicVariables=1

[meterResult]
Meter=String
X=5
Y=5
W=50
H=15
Text=""
So, I guess, how is the actual output of [&MeasureScript8:GetColor('cur_rgb')] in the Measure_RGB8 measure?
gkmaz9
Posts: 67
Joined: August 26th, 2019, 10:42 am

Re: How to apply Substitute\3 to IfCondition

Post by gkmaz9 »

mak_kawa wrote: February 21st, 2020, 4:49 am Hi gkmaz9

I have replaced the RGB value to your RGB example (254,165,20), and your substitution and IfCondition worked well (= displays "True").
So, I guess, how is the actual output of [&MeasureScript8:GetColor('cur_rgb')] in the Measure_RGB8 measure?
That is a measure of the change in the color value of the screen.
[&MeasureScript8:GetColor('cur_rgb')] outputs a value of r,g,b, but the value continues to change.
The value I want is false.
(20 >200)
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: How to apply Substitute\3 to IfCondition

Post by mak_kawa »

Sorry for my misunderstanding.

Reason is that the section variable [Measure_RGB] has both numeric (254; before substitution) and string (20) values.
So, enclosing variable name in IfCondition with brackets must solve the problem as IfCondition= [Measure_RGB8] > 200.

[SomeVar] -> referring string value
[SomeVar:] -> referring numeric value

Probably, in IfCondition expression, section name without brackets refers numeric value, I think.
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to apply Substitute\3 to IfCondition

Post by balala »

mak_kawa wrote: February 21st, 2020, 6:26 am Probably, in IfCondition expression, section name without brackets refers numeric value, I think.
No, the section name without the brackets refers to the string value, which can't be compared with a numeric value (200 in this case). Brackets are needed to convert this string value into a numeric value.
Note that beside adding the brackets, a DynamicVariables=1 option is also needed, but having it already there, this is ok.