It is currently October 4th, 2024, 12:16 am

MeasureStyle

Report bugs with the Rainmeter application and suggest features.
User avatar
Active Colors
Moderator
Posts: 1318
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

MeasureStyle

Post by Active Colors »

Typical scenario:

Code: Select all

[mIndex1Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=1
Group=Children
DynamicVariables=1

[mIndex2Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=2
Group=Children
DynamicVariables=1

[mIndex3Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=3
Group=Children
DynamicVariables=1

[mIndex4Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=4
Group=Children
DynamicVariables=1

[mIndex5Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=5
Group=Children
DynamicVariables=1
It could simply be:

Code: Select all

[mIndexTemplate]
Path=[mPath]
Type=FileName
Index=#CurrentSection#
Group=Children
DynamicVariables=1

[1]
Measure=Plugin
Plugin=FileView
MeasureStyle=mIndexTemplate

[2]
Measure=Plugin
Plugin=FileView
MeasureStyle=mIndexTemplate

[3]
Measure=Plugin
Plugin=FileView
MeasureStyle=mIndexTemplate

[4]
Measure=Plugin
Plugin=FileView
MeasureStyle=mIndexTemplate

[5]
Measure=Plugin
Plugin=FileView
MeasureStyle=mIndexTemplate
This example is pretty easy to copy-paste around, which could be an argument against this feature. However, other examples can include repetitive calc formulas, bangs, if conditions, and regex. This makes it inconvenient to carry a long formula accross every measure, especially if you need to edit the formula later. Putting the repeating stuff into variables works sometimes but you often need to do add additional asterisks around *variables* or use """magic quotes""" which adds to inconvenience.

The examples from this link show further situations when MeasureStyle would be handy:
https://forum.rainmeter.net/viewtopic.php?t=34067&start=10#p168515

Previous explanations mention that there is not enough repetitive things to group in a template (style). But there are ☹️

If we can do it with MeterStyles, I don’t see why we shouldn’t do it with MeasureStyles.

Previosly requested at least in: Could I ask to evaluate this feature once again?
User avatar
Yincognito
Rainmeter Sage
Posts: 8324
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: MeasureStyle

Post by Yincognito »

Personally, I support the idea, if it's not too difficult to implement and it's ok with backward compatibility. In combination with the little "current section index" retrieval script in Lua, it could simplify lots of things. If considered, hopefully it could work for any type of measure or plugin...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Jeff
Posts: 351
Joined: September 3rd, 2018, 11:18 am

Re: MeasureStyle

Post by Jeff »

+1-ing this too! Though I have come around some of the limitations by using Groups, Lua and !SetOption, it would still be worth to bring this system to Measures too, in order to fix the same issue MeterStyles solve(d), that is classes and repetition (and also to keep parity).

Ever since I made that post with examples, the only other place where I wished I had MeasureStyles was when making an HSL example.
The skin I made was

Code: Select all

[Rainmeter]
Update=25

[Variables]
V=1
S=1

[DummyMeter]
Meter=string

[Loop]
Measure=Loop
StartValue=1
EndValue=360

[V]
Measure=Calc
Formula=#V#

[S]
Measure=Calc
Formula=#S#

[H]
Measure=Calc
Formula=Loop

[C]
Measure=Calc
Formula=V*S

[X]
Measure=Calc
Formula=C*(1 - Abs( H/60 % 2 - 1) )

[m]
Measure=Calc
Formula=V-C

; newlined to make it easier to read
[Rprime]
Measure=Calc
Formula=(0 <= H) && (H < 60) ?
C :((60 <= H) && (H < 120) ?
X :((120 <= H) && (H < 180) ?
0 :((180 <= H) && (H < 240) ?
0 :((240 <= H) && (H < 300) ?
X :((300 <= H) && (H < 360) ?
C : C)))))

[Gprime]
Measure=Calc
Formula=(0 <= H) && (H < 60) ?
X :((60 <= H) && (H < 120) ?
C :((120 <= H) && (H < 180) ?
C :((180 <= H) && (H < 240) ?
X :((240 <= H) && (H < 300) ?
0 :((300 <= H) && (H < 360) ?
0 : 0)))))

[Bprime]
Measure=Calc
Formula=(0 <= H) && (H < 60) ?
0 :((60 <= H) && (H < 120) ?
0 :((120 <= H) && (H < 180) ?
X :((180 <= H) && (H < 240) ?
C :((240 <= H) && (H < 300) ?
C :((300 <= H) && (H < 360) ?
X : X)))))

[R]
Measure=Calc
Formula=Trunc((Rprime+m)*255)

[G]
Measure=Calc
Formula=Trunc((Gprime+m)*255)

[B]
Measure=Calc
Formula=Trunc((Bprime+m)*255)

[TestShape]
Meter=Image
SolidColor=[R],[G],[B]
H=200
W=200
DynamicVariables=1
but if I had MeasureStyles, the skin would become

Code: Select all

[Rainmeter]
Update=25

[Variables]
V=1
S=1

; put like this here for convenience to read, however they should be one line down
Rp1=C  Gp1=X  Bp1=0
Rp2=X  Gp2=C  Bp2=0
Rp3=0  Gp3=C  Bp3=X
Rp4=0  Gp4=X  Bp4=C
Rp5=X  Gp5=0  Bp5=C
Rp6=C  Gp6=0  Bp6=X

[DummyMeter]
Meter=string

[Loop]
Measure=Loop
StartValue=1
EndValue=360

[V]
Measure=Calc
Formula=#V#

[S]
Measure=Calc
Formula=#S#

[H]
Measure=Calc
Formula=Loop

[C]
Measure=Calc
Formula=V*S

[X]
Measure=Calc
Formula=C*(1 - Abs( H/60 % 2 - 1) )

[m]
Measure=Calc
Formula=V-C

; now we need a single measurestyle for all of that previous stuff, since nested variables set the correct measure name! newlined in this example to make it easier to read
[prime]
Formula=(0 <= H) && (H < 60) ?
[#[#CURRENTSECTION#]1] :((60 <= H) && (H < 120) ?
[#[#CURRENTSECTION#]2] :((120 <= H) && (H < 180) ?
[#[#CURRENTSECTION#]3] :((180 <= H) && (H < 240) ?
[#[#CURRENTSECTION#]4] :((240 <= H) && (H < 300) ?
[#[#CURRENTSECTION#]5] :((300 <= H) && (H < 360) ?
[#[#CURRENTSECTION#]6] : [#[#CURRENTSECTION#]6])))))

[Rp]
Measure=Calc
MeasureStyle=prime

[Gp]
Measure=Calc
MeasureStyle=prime

[Bp]
Measure=Calc
MeasureStyle=prime

[R]
Measure=Calc
Formula=Trunc((Rp+m)*255)

[G]
Measure=Calc
Formula=Trunc((Gp+m)*255)

[B]
Measure=Calc
Formula=Trunc((Bp+m)*255)

[TestShape]
Meter=Image
SolidColor=[R],[G],[B]
H=200
W=200
DynamicVariables=1
User avatar
Cariboudjan
Posts: 285
Joined: May 12th, 2019, 8:55 am

Re: MeasureStyle

Post by Cariboudjan »

Active Colors wrote: September 9th, 2024, 8:49 pm Typical scenario:

Code: Select all

[mIndex1Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=1
Group=Children
DynamicVariables=1

[mIndex2Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=2
Group=Children
DynamicVariables=1

[mIndex3Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=3
Group=Children
DynamicVariables=1

[mIndex4Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=4
Group=Children
DynamicVariables=1

[mIndex5Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=5
Group=Children
DynamicVariables=1
It could simply be:

Code: Select all

[mIndexTemplate]
Path=[mPath]
Type=FileName
Index=#CurrentSection#
Group=Children
DynamicVariables=1

[1]
Measure=Plugin
Plugin=FileView
MeasureStyle=mIndexTemplate

[2]
Measure=Plugin
Plugin=FileView
MeasureStyle=mIndexTemplate

[3]
Measure=Plugin
Plugin=FileView
MeasureStyle=mIndexTemplate

[4]
Measure=Plugin
Plugin=FileView
MeasureStyle=mIndexTemplate

[5]
Measure=Plugin
Plugin=FileView
MeasureStyle=mIndexTemplate
This example is pretty easy to copy-paste around, which could be an argument against this feature. However, other examples can include repetitive calc formulas, bangs, if conditions, and regex. This makes it inconvenient to carry a long formula accross every measure, especially if you need to edit the formula later. Putting the repeating stuff into variables works sometimes but you often need to do add additional asterisks around *variables* or use """magic quotes""" which adds to inconvenience.

The examples from this link show further situations when MeasureStyle would be handy:
https://forum.rainmeter.net/viewtopic.php?t=34067&start=10#p168515

Previous explanations mention that there is not enough repetitive things to group in a template (style). But there are ☹️

If we can do it with MeterStyles, I don’t see why we shouldn’t do it with MeasureStyles.

Previosly requested at least in: Could I ask to evaluate this feature once again?
Protip:

Code: Select all

[Variables]
mIndex1Name=1
mIndex2Name=2
mIndex3Name=3
mIndex4Name=4
mIndex5Name=5

[mIndex1Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=[##CURRENTSECTION#]
Group=Children
DynamicVariables=1

[mIndex2Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=[##CURRENTSECTION#]
Group=Children
DynamicVariables=1

[mIndex3Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=[##CURRENTSECTION#]
Group=Children
DynamicVariables=1

[mIndex4Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=[##CURRENTSECTION#]
Group=Children
DynamicVariables=1

[mIndex5Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=[##CURRENTSECTION#]
Group=Children
DynamicVariables=1
You could also do this:

Code: Select all

[Variables]
mIndex1Name=1
mIndex2Name=2
mIndex3Name=3
mIndex4Name=4
mIndex5Name=5

mIndex1Name.Path=mPath
mIndex2Name.Path=mPath
mIndex3Name.Path=mPath
mIndex4Name.Path=mPath
mIndex5Name.Path=mPath

mIndex1Name.Group=Children
mIndex2Name.Group=Children
mIndex3Name.Group=Children
mIndex4Name.Group=Children
mIndex5Name.Group=Children

mIndex1Name.Type=FileName
mIndex2Name.Type=FileName
mIndex3Name.Type=FileName
mIndex4Name.Type=FileName
mIndex5Name.Type=FileName

[mIndex1Name]
Measure=Plugin
Plugin=FileView
Path=[[##CURRENTSECTION#.Path]]
Type=[##CURRENTSECTION#.Type]
Index=[##CURRENTSECTION#]
Group=[##CURRENTSECTION#.Group]
DynamicVariables=1

[mIndex2Name]
Measure=Plugin
Plugin=FileView
Path=[[##CURRENTSECTION#.Path]]
Type=[##CURRENTSECTION#.Type]
Index=[##CURRENTSECTION#]
Group=[##CURRENTSECTION#.Group]
DynamicVariables=1

[mIndex3Name]
Measure=Plugin
Plugin=FileView
Path=[[##CURRENTSECTION#.Path]]
Type=[##CURRENTSECTION#.Type]
Index=[##CURRENTSECTION#]
Group=[##CURRENTSECTION#.Group]
DynamicVariables=1

[mIndex4Name]
Measure=Plugin
Plugin=FileView
Path=[[##CURRENTSECTION#.Path]]
Type=[##CURRENTSECTION#.Type]
Index=[##CURRENTSECTION#]
Group=[##CURRENTSECTION#.Group]
DynamicVariables=1

[mIndex5Name]
Measure=Plugin
Plugin=FileView
Path=[[##CURRENTSECTION#.Path]]
Type=[##CURRENTSECTION#.Type]
Index=[##CURRENTSECTION#]
Group=[##CURRENTSECTION#.Group]
DynamicVariables=1
User avatar
Yincognito
Rainmeter Sage
Posts: 8324
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: MeasureStyle

Post by Yincognito »

Cariboudjan wrote: September 12th, 2024, 10:53 pm[##CURRENTSECTION#]
Does this work and not confuse Rainmeter? Cause if it doesn't, [#[#CURRENTSECTION]] might be a more "standard" way to write it, via the nested syntax...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Cariboudjan
Posts: 285
Joined: May 12th, 2019, 8:55 am

Re: MeasureStyle

Post by Cariboudjan »

Ive been using it this way for years. No issue.
User avatar
Yincognito
Rainmeter Sage
Posts: 8324
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: MeasureStyle

Post by Yincognito »

Cariboudjan wrote: September 13th, 2024, 1:42 pm Ive been using it this way for years. No issue.
Thanks, good to know! :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Active Colors
Moderator
Posts: 1318
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: MeasureStyle

Post by Active Colors »

Yincognito wrote: September 12th, 2024, 11:22 pm Does this work and not confuse Rainmeter? Cause if it doesn't, [#[#CURRENTSECTION]] might be a more "standard" way to write it, via the nested syntax...
Yes, have been working well for me as well. Until you’ve made that CSI script.
I have posted about this but slightly different method earlier too (at the end of the post)
https://forum.rainmeter.net/viewtopic.php?t=37787
User avatar
Yincognito
Rainmeter Sage
Posts: 8324
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: MeasureStyle

Post by Yincognito »

Active Colors wrote: September 13th, 2024, 5:56 pm I have posted about this but slightly different method earlier too (at the end of the post)
https://forum.rainmeter.net/viewtopic.php?t=37787
Oh I see. That's a very nice and comprehensive post you have there, well done! :thumbup:
Active Colors wrote: September 13th, 2024, 5:56 pm Yes, have been working well for me as well. Until you’ve made that CSI script.
Just to make sure I correctly understood what you said: it's not that the CSI script I made somehow broke or made unusable any of these alternative syntaxes, but rather avoided the need to use some of them in certain situations in the first place, right? :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1821
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: MeasureStyle

Post by sl23 »

I recently asked about measure styles again due to have an identical IfMatch action across 40 fileview child measures. When you want to change it, you have to change all 40! But now I have 3 separate fileview set ups each has 20 children and all have that same IfMatch action. That's 60 times I have to change it now. Would be so helpful to have Measure Styles! I'm glad someone else has seen the benefits of having this function.

Just so you know, in case you hadn't guessed, that's a plus one from me! :D
57686174 77696C6C 6265 77696C6C 6265