Hackit wrote: ↑April 5th, 2020, 1:18 pm

so i need to add DynamicWindowSize=1 to every part of my skin that has StringAlign=right include DynamicWindowSize=1, then set all using X/Y/W/H?

do i need to have the skin W/H set?

Nope.

DynamicWindowSize=1 belongs to the

[Rainmeter] section of a skin, and that is unique - you don't need to add it everywhere.

I think it's best if I show how you should approach this by example:

Code: Select all

```
[Variables]
MinSkinWidth=300
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
---Measures---
[MeasureLongString]
Measure=Calc
Formula=(MeasureLongString+1)%2
UpdateDivider=3
RegExpSubstitute=1
Substitute="^0$":"A not so long string","^1$":"A very very very very very very very very very very very very very very very very very long string"
DynamicVariables=1
---Meters---
[MeterLAlignedString0]
Meter=STRING
X=0
Y=0R
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=10
AntiAlias=1
StringAlign=Left
Text="L. Aligned string at 0%"
DynamicVariables=1
[MeterCAlignedString50]
Meter=STRING
X=((([MeterLongString:W]<#MinSkinWidth#)?(#MinSkinWidth#):[MeterLongString:W])/2)
Y=0R
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=10
AntiAlias=1
StringAlign=Center
Text="C. Aligned string at 50%"
DynamicVariables=1
[MeterRAlignedString100]
Meter=STRING
X=(([MeterLongString:W]<#MinSkinWidth#)?(#MinSkinWidth#):[MeterLongString:W])
Y=0R
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=10
AntiAlias=1
StringAlign=Right
Text="R. Aligned string at 100%"
DynamicVariables=1
[MeterRAlignedString33]
Meter=STRING
X=((([MeterLongString:W]<#MinSkinWidth#)?(#MinSkinWidth#):[MeterLongString:W])*0.33)
Y=0R
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=10
AntiAlias=1
StringAlign=Right
Text="R. Aligned string at 33%"
DynamicVariables=1
[MeterLAlignedString33]
Meter=STRING
X=((([MeterLongString:W]<#MinSkinWidth#)?(#MinSkinWidth#):[MeterLongString:W])*0.33)
Y=0R
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=10
AntiAlias=1
StringAlign=Left
Text="L. Aligned string at 33%"
DynamicVariables=1
[MeterLongString]
Meter=STRING
X=0
Y=0R
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=10
AntiAlias=1
MeasureName=MeasureLongString
Text="%1"
DynamicVariables=1
```

As you can see, it's only one

DynamicWindowSize=1, in the

[Rainmeter] section. All string meters except

[MeterLongString] (which is a simulation of a long current condition text) are aligned in various ways, but

always in relation to the width of

[MeterLongString] (see their X values), in effect making the skin's layout to widen up or shrink up in order to adapt to the width of our current condition text simulation. The measure in this skin is there just to "toggle" between a shorter and a longer string, it isn't needed in your case (as they say, for demonstration purposes only).

Now, a bit on the formulas. Normally, there shouldn't be any need for increased complexity in the formulas, as a

([MeterLongString:W]*0.33) should be enough if we want to set the X of a certain meter to one third of the long text's width, for example. However, since this is a simulation of the current condition text (a WebParser measure), we know that those measures have an empty (

"") initial value, at least until they are populated from the parsed page source, that is. This means that using the simple formula above would produce a skin

0 px wide in the brief moments until the measures get populated from the site. A

0 px wide (virtually invisible) skin is not what we want, even if it's for a very short period of time in theory, so we set the

MinSkinWidth variable to a value of

300 px (can be any value you like) in order to have a "standard" / "minimum" skin size (or rather, condition text width) that we can base our calculation of the other meters' X-es on.

This means that

([MeterLongString]*0.33) will become

((([MeterLongString:W]<#MinSkinWidth#)?(#MinSkinWidth#):[MeterLongString:W])*0.33), which basically tells Rainmeter to use

#MinSkinWidth# (300, in this case) when multiplying with

0.33, if the width of the long string meter is below the value of

#MinSkinWidth#, and the width of the long string meter itself if not. This type of formula is a

conditional (pardon my excessive use of brackets).

One other thing you should be aware of is that normally there is a delay of one update cycle between the moment when the long string toggles to a different value and the moment when the other meters' X-es are updated to reflect that. This is because

[MeterLongString] is placed

after the other meters in the skin (so those meters won't know its width until the next update). Placing the meter

before the other meters depending on it solves the issue (but you'd need to avoid using relative

r and

R coordinates if you want to place it lower in the actual skin, visually). Another option (that is actually used in this case) is to update and redraw the meters immediately after

[MeterLongString] gets its new value - I've used

OnUpdateAction=[!UpdateMeter *][!Redraw] here, but since we're talking about WebParser measures, it will probably be more along the lines of

FinishAction=[!UpdateMeter *][!Redraw].

Hopefully I've been reasonably clear in showing and explaining how the whole thing should be approached...