It is currently March 28th, 2024, 2:27 pm

Text Alignment

Get help with creating, editing & fixing problems with skins
Post Reply
streetsoda
Posts: 2
Joined: March 12th, 2019, 2:40 pm

Text Alignment

Post by streetsoda »

I want to change the text alignment for weather conditions in the following code. I am aware of the StringAlign function but it restricts me to anchoring the text within a given meter. As of now, the text is displayed on the right side of the rectangle but I'd like to change it to the left side instead. The attached image should explain my concern better. Help is appreciated.

Code: Select all

[Rainmeter]
Update=1000
Author=Connect-R
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
AccurateText=1
MouseScrollUpAction=[!SetVariable Scale "(#Scale#+#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#+#ScrollMouseIncrement#)"][!Refresh] 
MouseScrollDownAction=[!SetVariable Scale "(#Scale#-#ScrollMouseIncrement# < 0.2 ? 0.2 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.2 ? 0.2 : #Scale#-#ScrollMouseIncrement#)"][!Refresh]


[Variables]
@include=#@#Variables.inc
@include2=#@#Language\#Language#.inc
Scale=0.5


;-------------------------------------------------------------
;-------------------------------------------------------------

[MeasureCurrent]
Measure=Plugin
Plugin=WebParser.dll
UpdateRate=900
Url=http://wxdata.weather.com/wxdata/weather/local/#Location#?cc=*&unit=#Unit#
RegExp="(?siU)<head>.*<ut>(.*)</ut>.*<dnam>(.*),.*</dnam>.*<tmp>(.*)</tmp>.*<t>(.*)</t>"

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeasureTempUnit]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureCurrent]
StringIndex=1

[MeasureWeatherTemp]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureCurrent]
StringIndex=3

[MeasureWeatherCond]
Measure=Plugin
Plugin=WebParser.dll
Url=[MeasureCurrent]
StringIndex=4
Substitute=#Conditions#

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterBackg]
Meter=Shape
X=0
Y=0
Shape=Rectangle 1,1,(220*#Scale#),(386*#Scale#) | Fill Color #FontColor2# | Stroke Color #FontColor2#,0
UpdateDivider=-1

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeasureTime]
Measure=Time
Format="%#Format#:%M"

[MeasureAMPM]
Measure=Time
Format="%p"

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeasureDay]
Measure=Time
Format=%A
Substitute=#Date#

[MeasureDate]
Measure=Time
Format=%d

[MeasureMonth]
Measure=Time
Format=%B
Substitute=#Date#

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterDate]
Meter=String
MeasureName=MeasureDate
StringAlign=Center
StringCase=Upper
FontColor=#FontColor3#
FontFace=Roboto Light
FontSize=(85*#Scale#)
X=(110*#Scale#)
Y=(150*#Scale#)
Text="%1"
AntiAlias=1

[MeterMonth]
Meter=String
MeasureName=MeasureMonth
StringAlign=Center
StringCase=Upper
FontColor=#FontColor3#
FontFace=Roboto
FontSize=(25*#Scale#)
X=(110*#Scale#)
Y=(280*#Scale#)
Text="%1"
AntiAlias=1

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeterCurrentCond]
Meter=String
MeasureName=MeasureWeatherCond
MeasureName2=MeasureWeatherTemp
MeasureName3=MeasureTempUnit
StringAlign=Left
FontColor=#FontColor#
FontFace=Roboto
FontSize=(28*#Scale#)
X=(250*#Scale#)
Y=(275*#Scale#)
Text="%1 %2 °%3"
AntiAlias=1
Attachments
Sample.png
Last edited by streetsoda on March 12th, 2019, 4:27 pm, edited 1 time in total.
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Text Alignment

Post by CyberTheWorm »

Just play around with the X=(110*#Scale#) and X=(250*#Scale#)

The 250 puts the conditions to the right try switching the values and adjust
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Text Alignment

Post by balala »

streetsoda wrote: March 12th, 2019, 2:54 pm I want to change the text alignment for weather conditions in the following code. I am aware of the StringAlign function but it restricts me to anchoring the text within a given meter. As of now, the text is displayed on the right side of the rectangle but I'd like to change it to the left side instead. The attached image should explain my concern better.
Theoretically adding a StringAling=Right option to the [MeterCurrentCond] meter and reducing its X value should help. How much you should have to reduce it depends, but I suppose something around X=(50*#Scale#) should have to be ok. You have to experiment a little bit to find the best value, but this is the idea.
The problem probably will be that this way the condition goes outside of the skin, to left. A skin can't show meters placed too left, because they go partially or totally outside of the active surface of the skin (the regions with positive coordinates), so probably you have to increase the numeric values used into the X options of all three String meters ([MeterDate], [MeterMonth] and [MeterCurrentCond]). If needed, add 100 (or even more or less) to each of them:

Code: Select all

[MeterDate]
...
X=(210*#Scale#)
...

[MeterMonth]
...
X=(210*#Scale#)
...

[MeterCurrentCond]
...
X=(150*#Scale#)
A few tries will be needed, to find the best values.
streetsoda
Posts: 2
Joined: March 12th, 2019, 2:40 pm

Re: Text Alignment

Post by streetsoda »

Thank you! Your considerations have it worked. :)
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Text Alignment

Post by balala »

streetsoda wrote: March 12th, 2019, 4:26 pm Thank you! Your considerations have it worked. :)
If you're talking about mine, I'm glad.
Post Reply