It is currently October 16th, 2024, 10:28 am

Meters Auto-Adjust to container's height (?)

Get help with creating, editing & fixing problems with skins
RicardoTM
Posts: 366
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Meters Auto-Adjust to container's height (?)

Post by RicardoTM »

So I might be doing something wrong. If I use trunc or round the text goes up lol

I put the formula (([&Cntnr:H]-([&T0:H]+[&T1:H]+[&T2:H]+[&T3:H]+[&T4:H]+[&T5:H]+[&T6:H]+[&T7:H]))/7) on al calc measure and the value is 4.85714, when I truncate it trunc(([&Cntnr:H]-([&T0:H]+[&T1:H]+[&T2:H]+[&T3:H]+[&T4:H]+[&T5:H]+[&T6:H]+[&T7:H]))/7) the value is obviously 4. If I round it, it is 5. Either 4 or 5 will push the text up lol.

Not truncated nor rounded:
Captura de pantalla 2024-10-12 144019.png
Truncated or rounded:
Captura de pantalla 2024-10-12 144034.png
The Container's Height = 390, YH = 560.

Edit. nvm i'm stupid, I forgot to put the round on parenthesis as well lol
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 8471
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Meters Auto-Adjust to container's height (?)

Post by Yincognito »

Yeah, I'm pretty sure that doing round or trunc on the entire division will NOT work in all cases, since you'll reduce or increase ALL gaps, which will result in their sum ceasing to be what the sum of the fractional gaps is.

Like I said, you'll have to do this in every meter, instead of in a common style, in order to distribute the 0.FF fractional parts as evenly as possible to alternating integer gaps, whose sum is the same as the sum of the fractional gaps.

What I would do is first compute the fractional gap in a measure or a variable, but AFTER the meters have been updated so that their heights are not 0 or outdated (e.g. if you compute it in a measure called FGap, use OnRefreshAction for the initial computation given that the event happens after the first skin update, and update meters first and only then the said measure when scrolling to change the container height).

Then, in the 1st to Nth meter, I would use something like:

Code: Select all

Y=(Round([FGap]*1)-Round([FGap]*0))R

Code: Select all

Y=(Round([FGap]*2)-Round([FGap]*1))R

Code: Select all

Y=(Round([FGap]*3)-Round([FGap]*2))R
... and so on ...
to get and use the adjusted integer gaps (in shorter formulas, by the way).

This is precisely what I (mentally) did in my example about the 8 gaps of 7.375 pixels earlier, to ensure the sum of the resulting 7-s and 8-s is 59 like the sum of all 8 fractional gaps of 7.375 (where 59 would obviously be the height of the container minus the heights of all meters). That should work because:
- if you sum up the first 2 integer gaps, you get Round([FGap]*2)-Round([FGap]*1)+Round([FGap]*1)-Round([FGap]*0)),
where -Round([FGap]*1)+Round([FGap]*1) reduce / cancel each other,
Round([FGap]*0) is 0,
thus the result is the plain Round([FGap]*2)
- which becomes Round([FGap]*3) if you sum up the first 3 integer gaps
- and eventually Round([FGap]*8) aka 59 aka the [FGap]*8 sum of all fractional gaps, since the latter is also an integer (or at least, a value very close to that integer), as the difference between the container height and the height of all meters

You can test this in the 10 meter sample earlier to verify my theory. If the last meter is always "glued" to the very bottom of the container, then it checks out. I'll let you think about whether it will also check out for negative gaps when all meters are taller than the container, if that's the case. ;-)

P.S. I reckon that using Trunc() instead of Round() would more or less check out too, if you prefer that (it could help with negative gaps, I suppose, although it might not give the fractional gap sum, if that's something like 58.99).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 8471
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Meters Auto-Adjust to container's height (?)

Post by Yincognito »

Yincognito wrote: October 12th, 2024, 11:26 pmYou can test this in the 10 meter sample earlier to verify my theory.
Nevermind, I'll do that too. Bar a minor omission from my part (the 1st meter doesn't use any gap, so the Y-s will be offset by one meter), it works.

The 20 meter sample (more obvious if you compare the original version with the correct one for, say, FGH aka the container height at 493 or 492):
- original:

Code: Select all

[Variables]
NumberOfMeters=20
FGW=400
FGH=500

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

---Styles---

[Text]
Container=Container
FontColor=255,255,255
FontSize=12
StringAlign=Center
X=([Container:W]/2)
Y=(([Container:H]-[Text1:H]-[Text2:H]-[Text3:H]-[Text4:H]-[Text5:H]-[Text6:H]-[Text7:H]-[Text8:H]-[Text9:H]-[Text10:H]-[Text11:H]-[Text12:H]-[Text13:H]-[Text14:H]-[Text15:H]-[Text16:H]-[Text17:H]-[Text18:H]-[Text19:H]-[Text20:H])/([#NumberOfMeters]-1))R
DynamicVariables=1
SolidColor=255,0,0,255

---Meters---

[Background]
Meter=Image
SolidColor=0,0,0
W=500
H=600

[Foreground]
Meter=Image
SolidColor=32,32,32
W=[#FGW]
H=[#FGH]
Y=50
X=([Background:W]-[Container:W])/2
DynamicVariables=1

[Container]
Meter=Image
SolidColor=32,32,32
W=[Foreground:W]
H=[Foreground:H]
Y=50
X=([Background:W]-[Container:W])/2
MouseScrollUpAction=[!SetVariable FGH (Clamp([#FGH]+1,1,500))][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable FGH (Clamp([#FGH]-1,1,500))][!UpdateMeter *][!Redraw]
DynamicVariables=1

[Text1]
Meter=String
MeterStyle=Text
Text=THIS IS THE FIRST STRING.
FontSize=25
Y=r

[Text2]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=12

[Text3]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=13

[Text4]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=7

[Text5]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=18

[Text6]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=35

[Text7]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=2

[Text8]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=19

[Text9]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=6

[Text10]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=5

[Text11]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=8

[Text12]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=7

[Text13]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=10

[Text14]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=18

[Text15]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=26

[Text16]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=35

[Text17]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=18

[Text18]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=7

[Text19]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=6

[Text20]
Meter=String
MeterStyle=Text
Text=This is the last string.
FontSize=5
- correct:

Code: Select all

[Variables]
NumberOfMeters=20
FGW=400
FGH=500

[Rainmeter]
Update=-1
AccurateText=1
DynamicWindowSize=1
OnRefreshAction=[!UpdateMeasure FGap][!UpdateMeter *][!Redraw]

---Measures---

[FGap]
Measure=Calc
Formula=(([Container:H]-[Text1:H]-[Text2:H]-[Text3:H]-[Text4:H]-[Text5:H]-[Text6:H]-[Text7:H]-[Text8:H]-[Text9:H]-[Text10:H]-[Text11:H]-[Text12:H]-[Text13:H]-[Text14:H]-[Text15:H]-[Text16:H]-[Text17:H]-[Text18:H]-[Text19:H]-[Text20:H])/([#NumberOfMeters]-1))
DynamicVariables=1

---Styles---

[Text]
Container=Container
FontColor=255,255,255
FontSize=12
StringAlign=Center
X=([Container:W]/2)
DynamicVariables=1
SolidColor=255,0,0,255

---Meters---

[Background]
Meter=Image
SolidColor=0,0,0
W=500
H=600

[Foreground]
Meter=Image
SolidColor=32,32,32
W=[#FGW]
H=[#FGH]
Y=50
X=([Background:W]-[Container:W])/2
DynamicVariables=1

[Container]
Meter=Image
SolidColor=32,32,32
W=[Foreground:W]
H=[Foreground:H]
Y=50
X=([Background:W]-[Container:W])/2
MouseScrollUpAction=[!SetVariable FGH (Clamp([#FGH]+1,1,500))][!UpdateMeter *][!UpdateMeasure FGap][!Redraw]
MouseScrollDownAction=[!SetVariable FGH (Clamp([#FGH]-1,1,500))][!UpdateMeter *][!UpdateMeasure FGap][!Redraw]
DynamicVariables=1

[Text1]
Meter=String
MeterStyle=Text
Text=THIS IS THE FIRST STRING.
FontSize=25
Y=r

[Text2]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=12
Y=(Round([FGap]*1)-Round([FGap]*0))R

[Text3]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=13
Y=(Round([FGap]*2)-Round([FGap]*1))R

[Text4]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=7
Y=(Round([FGap]*3)-Round([FGap]*2))R

[Text5]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=18
Y=(Round([FGap]*4)-Round([FGap]*3))R

[Text6]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=35
Y=(Round([FGap]*5)-Round([FGap]*4))R

[Text7]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=2
Y=(Round([FGap]*6)-Round([FGap]*5))R

[Text8]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=19
Y=(Round([FGap]*7)-Round([FGap]*6))R

[Text9]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=6
Y=(Round([FGap]*8)-Round([FGap]*7))R

[Text10]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=5
Y=(Round([FGap]*9)-Round([FGap]*8))R

[Text11]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=8
Y=(Round([FGap]*10)-Round([FGap]*9))R

[Text12]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=7
Y=(Round([FGap]*11)-Round([FGap]*10))R

[Text13]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=10
Y=(Round([FGap]*12)-Round([FGap]*11))R

[Text14]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=18
Y=(Round([FGap]*13)-Round([FGap]*12))R

[Text15]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=26
Y=(Round([FGap]*14)-Round([FGap]*13))R

[Text16]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=35
Y=(Round([FGap]*15)-Round([FGap]*14))R

[Text17]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=18
Y=(Round([FGap]*16)-Round([FGap]*15))R

[Text18]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=7
Y=(Round([FGap]*17)-Round([FGap]*16))R

[Text19]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=6
Y=(Round([FGap]*18)-Round([FGap]*17))R

[Text20]
Meter=String
MeterStyle=Text
Text=This is the last string.
FontSize=5
Y=(Round([FGap]*19)-Round([FGap]*18))R
The 10 meter sample (less obvious if you compare the original version with the correct one for, say, FGH aka the container height at 494 or 493):
- original:

Code: Select all

[Variables]
NumberOfMeters=10
FGW=400
FGH=500

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

---Styles---

[Text]
Container=Container
FontColor=255,255,255
FontSize=12
StringAlign=Center
X=([Container:W]/2)
Y=(([Container:H]-[Text1:H]-[Text2:H]-[Text3:H]-[Text4:H]-[Text5:H]-[Text6:H]-[Text7:H]-[Text8:H]-[Text9:H]-[Text10:H])/([#NumberOfMeters]-1))R
DynamicVariables=1
SolidColor=255,0,0,255

---Meters---

[Background]
Meter=Image
SolidColor=0,0,0
W=500
H=600

[Foreground]
Meter=Image
SolidColor=32,32,32
W=[#FGW]
H=[#FGH]
Y=50
X=([Background:W]-[Container:W])/2
DynamicVariables=1

[Container]
Meter=Image
SolidColor=32,32,32
W=[Foreground:W]
H=[Foreground:H]
Y=50
X=([Background:W]-[Container:W])/2
MouseScrollUpAction=[!SetVariable FGH (Clamp([#FGH]+1,1,500))][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable FGH (Clamp([#FGH]-1,1,500))][!UpdateMeter *][!Redraw]
DynamicVariables=1

[Text1]
Meter=String
MeterStyle=Text
Text=THIS IS THE FIRST STRING.
Y=r
FontSize=17

[Text2]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=11

[Text3]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=7

[Text4]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=25

[Text5]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=2

[Text6]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=13

[Text7]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=6

[Text8]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=8

[Text9]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=10

[Text10]
Meter=String
MeterStyle=Text
Text=This is the last string.
FontSize=16
- correct:

Code: Select all

[Variables]
NumberOfMeters=10
FGW=400
FGH=500

[Rainmeter]
Update=-1
AccurateText=1
DynamicWindowSize=1
OnRefreshAction=[!UpdateMeasure FGap][!UpdateMeter *][!Redraw]

---Measures---

[FGap]
Measure=Calc
Formula=(([Container:H]-[Text1:H]-[Text2:H]-[Text3:H]-[Text4:H]-[Text5:H]-[Text6:H]-[Text7:H]-[Text8:H]-[Text9:H]-[Text10:H])/([#NumberOfMeters]-1))
UpdateDivider=-1
DynamicVariables=1

---Styles---

[Text]
Container=Container
FontColor=255,255,255
FontSize=12
StringAlign=Center
X=([Container:W]/2)
DynamicVariables=1
SolidColor=255,0,0,255

---Meters---

[Background]
Meter=Image
SolidColor=0,0,0
W=500
H=600

[Foreground]
Meter=Image
SolidColor=32,32,32
W=[#FGW]
H=[#FGH]
Y=50
X=([Background:W]-[Container:W])/2
DynamicVariables=1

[Container]
Meter=Image
SolidColor=32,32,32
W=[Foreground:W]
H=[Foreground:H]
Y=50
X=([Background:W]-[Container:W])/2
MouseScrollUpAction=[!SetVariable FGH (Clamp([#FGH]+1,1,500))][!UpdateMeter *][!UpdateMeasure FGap][!Redraw]
MouseScrollDownAction=[!SetVariable FGH (Clamp([#FGH]-1,1,500))][!UpdateMeter *][!UpdateMeasure FGap][!Redraw]
DynamicVariables=1

[Text1]
Meter=String
MeterStyle=Text
Text=THIS IS THE FIRST STRING.
Y=r
FontSize=17

[Text2]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
Y=(Round([FGap]*1)-Round([FGap]*0))R
FontSize=11

[Text3]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
Y=(Round([FGap]*2)-Round([FGap]*1))R
FontSize=7

[Text4]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
Y=(Round([FGap]*3)-Round([FGap]*2))R
FontSize=25

[Text5]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
Y=(Round([FGap]*4)-Round([FGap]*3))R
FontSize=2

[Text6]
Meter=String
MeterStyle=Text
Text=This is a test string.
Y=(Round([FGap]*5)-Round([FGap]*4))R
FontSize=13

[Text7]
Meter=String
MeterStyle=Text
Text=This is a test string.
Y=(Round([FGap]*6)-Round([FGap]*5))R
FontSize=6

[Text8]
Meter=String
MeterStyle=Text
Text=This is a test string.
Y=(Round([FGap]*7)-Round([FGap]*6))R
FontSize=8

[Text9]
Meter=String
MeterStyle=Text
Text=This is a test string.
Y=(Round([FGap]*8)-Round([FGap]*7))R
FontSize=10

[Text10]
Meter=String
MeterStyle=Text
Text=This is the last string.
Y=(Round([FGap]*9)-Round([FGap]*8))R
FontSize=16
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
RicardoTM
Posts: 366
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Meters Auto-Adjust to container's height (?)

Post by RicardoTM »

Hey Ying sorry for the late answer, I had to go out yesterday and came back late at night and I simply went to sleep, I'll now check what you mentioned.

Honestly I was avoiding doing it meter by meter even I understood what you meant from the beginning (I'm lazyyy). I'll do the testing on the tutorial as well anyway to see how it behaves.
RicardoTM
Posts: 366
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Meters Auto-Adjust to container's height (?)

Post by RicardoTM »

Alright, I tested it on all the tutorial pages and it works fine, a little better on some pages.

I made it into a formula Y=(Round([FGap]*[#CurrentSection])-Round([FGap]*([#CurrentSection]-1)))R
and renamed every meter as numbers starting from 0.

This way there's no need to add the line to each meter. (This could be unavoidable on some cases though).

Modified example skin:

Code: Select all

[Variables]
NumberOfMeters=10
FGW=400
FGH=500

[Rainmeter]
Update=-1
AccurateText=1
DynamicWindowSize=1
OnRefreshAction=[!UpdateMeasure FGap][!UpdateMeter *][!Redraw]

---Measures---

[FGap]
Measure=Calc
Formula=(([Container:H]-[0:H]-[1:H]-[2:H]-[3:H]-[4:H]-[5:H]-[6:H]-[7:H]-[8:H]-[9:H])/([#NumberOfMeters]-1))
UpdateDivider=-1
DynamicVariables=1

---Styles---

[Text]
Container=Container
FontColor=255,255,255
FontSize=12
StringAlign=Center
X=([Container:W]/2)
Y=(Round([FGap]*[#CurrentSection])-Round([FGap]*([#CurrentSection]-1)))R
;Y=(Trunc([FGap]*[#CurrentSection])-Trunc([FGap]*([#CurrentSection]-1)))R
DynamicVariables=1
SolidColor=255,0,0,255

---Meters---

[Background]
Meter=Image
SolidColor=0,0,0
W=500
H=600

[Foreground]
Meter=Image
SolidColor=32,32,32
W=[#FGW]
H=[#FGH]
Y=50
X=([Background:W]-[Container:W])/2
DynamicVariables=1

[Container]
Meter=Image
SolidColor=32,32,32
W=[Foreground:W]
H=[Foreground:H]
Y=50
X=([Background:W]-[Container:W])/2
MouseScrollUpAction=[!SetVariable FGH (Clamp([#FGH]+1,1,500))][!UpdateMeter *][!UpdateMeasure FGap][!Redraw]
MouseScrollDownAction=[!SetVariable FGH (Clamp([#FGH]-1,1,500))][!UpdateMeter *][!UpdateMeasure FGap][!Redraw]
DynamicVariables=1

[0]
Meter=String
MeterStyle=Text
Text=THIS IS THE FIRST STRING.
Y=r
FontSize=17

[1]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=11

[2]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=7

[3]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=25

[4]
Meter=String
MeterStyle=Text
Text=THIS IS A TEST STRING.
FontSize=2

[5]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=13

[6]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=6

[7]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=8

[8]
Meter=String
MeterStyle=Text
Text=This is a test string.
FontSize=10

[9]
Meter=String
MeterStyle=Text
Text=This is the last string.
FontSize=16
I also added the trunc option on a commented line on the texts style. It works the same on this example but I noticed a little difference on one of my tutorial pages. But I see what you mean with negative values in case it's used on a scrollable container.
User avatar
Yincognito
Rainmeter Sage
Posts: 8471
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Meters Auto-Adjust to container's height (?)

Post by Yincognito »

RicardoTM wrote: October 13th, 2024, 5:01 pm Alright, I tested it on all the tutorial pages and it works fine, a little better on some pages.

I made it into a formula Y=(Round([FGap]*[#CurrentSection])-Round([FGap]*([#CurrentSection]-1)))R
and renamed every meter as numbers starting from 0.

This way there's no need to add the line to each meter. (This could be unavoidable on some cases though).

[...]

I also added the trunc option on a commented line on the texts style. It works the same on this example but I noticed a little difference on one of my tutorial pages. But I see what you mean with negative values in case it's used on a scrollable container.
Good choice with the style! By the way, if you're using Lua anyway in your skins, you could name and index sections in any way and use this little function I wrote a couple of years ago to get the "current section index" (or any "index" of any section, for that matter):
https://forum.rainmeter.net/viewtopic.php?t=36895&start=20#p190339
This would be useful if you have more sets of sections to get their index from at will, since there's only one set you can rename to [0], [1], and so on, given that section names must be unique in a skin.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
RicardoTM
Posts: 366
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Meters Auto-Adjust to container's height (?)

Post by RicardoTM »

Yincognito wrote: October 14th, 2024, 5:57 am Good choice with the style! By the way, if you're using Lua anyway in your skins, you could name and index sections in any way and use this little function I wrote a couple of years ago to get the "current section index" (or any "index" of any section, for that matter):
https://forum.rainmeter.net/viewtopic.php?t=36895&start=20#p190339
This would be useful if you have more sets of sections to get their index from at will, since there's only one set you can rename to [0], [1], and so on, given that section names must be unique in a skin.
You read my mind, I was thinking of a way to retrieve the current section numbers. I'll take a look at your script, thanks 👌🏽

I had all my meters on the tutorial Named T0, T1 and so on and I had to rename them to use my style method lol.

I can use the script for the list on the gauge since those meters I can't rename them
User avatar
Yincognito
Rainmeter Sage
Posts: 8471
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Meters Auto-Adjust to container's height (?)

Post by Yincognito »

RicardoTM wrote: October 14th, 2024, 5:02 pm You read my mind, I was thinking of a way to retrieve the current section numbers. I'll take a look at your script, thanks 👌🏽

I had all my meters on the tutorial Named T0, T1 and so on and I had to rename them to use my style method lol.

I can use the script for the list on the gauge since those meters I can't rename them
Excellent! :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
RicardoTM
Posts: 366
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Meters Auto-Adjust to container's height (?)

Post by RicardoTM »

Yincognito wrote: October 14th, 2024, 5:47 pm Excellent! :thumbup:
I just tested it on the tutorial and it works perfectly 👌🏽

I don't think I can use it on the list though since I have strings followed by shapes which are named "Sensor1" and "Sensor1s". Since those would need a different index name e.g 1Sensor1 and 2Sensor1s, it would "break" my other formulas based on current section ([#CurrentSection]s) lol

Edit. I'm thinking I can use groups to solve it, since the only thing I'm using it for is for mouse over/leave actions, so I can change those SetOption [#CurrentSection]/[#CurrentSection]s for SetOptionGroup [#CurrentSection]. Strings won't be affected by shape options nor shapes by string options anyway.
User avatar
Yincognito
Rainmeter Sage
Posts: 8471
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Meters Auto-Adjust to container's height (?)

Post by Yincognito »

RicardoTM wrote: October 14th, 2024, 5:58 pm I just tested it on the tutorial and it works perfectly 👌🏽

I don't think I can use it on the list though since I have strings followed by shapes which are named "Sensor1" and "Sensor1s". Since those would need a different index name e.g 1Sensor1 and 2Sensor1s, it would "break" my other formulas based on current section ([#CurrentSection]s) lol

Edit. I'm thinking I can use groups to solve it, since the only thing I'm using it for is for mouse over/leave actions, so I can change those SetOption [#CurrentSection]/[#CurrentSection]s for SetOptionGroup [#CurrentSection]. Strings won't be affected by shape options nor shapes by string options anyway.
You know best what you have in your skin. When it comes to the function I wrote, that can be customized differently, e.g get the the last 2 or 3 chars from the section name, etc. It's meant to help others, not to have its code set in stone, you know... ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth