It is currently September 14th, 2024, 5:44 pm

Change widget position depending on the day of the week

Get help with creating, editing & fixing problems with skins
IvanAstran
Posts: 1
Joined: June 11th, 2024, 8:44 am

Change widget position depending on the day of the week

Post by IvanAstran »

I have a widget for Rainmeter that shows the days of the week.
But each day of the week has a different number of letters, so the word keeps moving out and I have to correct it.
I need to make it so that each day of the week has a different position.
I tried to do it myself, but it didn't work out. (Sorry if it's not clear, I'm using google translator.)

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.5 ? 0.5 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.5 ? 0.5 : #Scale#-#ScrollMouseIncrement#)"][!Refresh]
LeftMouseDoubleClickAction=!ToggleConfig "Mond\Settings" "Settings.ini"

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

;-------------------------------------------------------------
; Measures
;-------------------------------------------------------------

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

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

[MeasureDay]
Measure=Time
Format=%A

[MeasureDate]
Measure=Time
Format=%d  %B,  %Y.
Substitute=#Date#

;-------------------------------------------------------------
; Meters
;-------------------------------------------------------------

[Meter24hClock]
Meter=String
MeasureName=MeasureTime
StringAlign=Center
StringCase=Upper
FontFace=Quicksand
FontColor=#TextColor#
FontSize=(14*#Scale#)
X=(340*#Scale#)
Y=(110*#Scale#)
Text="- %1 -"
AntiAlias=1
Hidden=#Hidden#

[Meter12hClock]
Meter=String
MeasureName=MeasureTime
MeasureName2=MeasureAmPm
StringAlign=Center
StringCase=Upper
FontFace=Quicksand
FontColor=#TextColor#
FontSize=(14*#Scale#)
X=(340*#Scale#)
Y=(120*#Scale#)
Text="- %1 %2 -"
AntiAlias=1
Hidden=#Hidden2#

; Метки для каждого дня недели

[MeterMonday]
Meter=String
MeasureName=MeasureDay
Text="MONDAY"
X=(320*#Scale#)
Y=(0*#Scale#)
FontFace=Anurati
FontSize=(40*#Scale#)
FontColor=#TextColor#
StringAlign=Left
StringCase=Upper
AntiAlias=1
Hidden=1
IfMatch="Monday"
IfMatchAction=[!SetOption MeterMonday Hidden 0][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption MeterMonday Hidden 1][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterTuesday]
Meter=String
MeasureName=MeasureDay
Text="TUESDAY"
X=(310*#Scale#)
Y=(0*#Scale#)
FontFace=Anurati
FontSize=(40*#Scale#)
FontColor=#TextColor#
StringAlign=Left
StringCase=Upper
AntiAlias=1
Hidden=1
IfMatch="Tuesday"
IfMatchAction=[!SetOption MeterTuesday Hidden 0][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption MeterTuesday Hidden 1][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterWednesday]
Meter=String
MeasureName=MeasureDay
Text="WEDNESDAY"
X=(280*#Scale#)
Y=(0*#Scale#)
FontFace=Anurati
FontSize=(40*#Scale#)
FontColor=#TextColor#
StringAlign=Left
StringCase=Upper
AntiAlias=1
Hidden=1
IfMatch="Wednesday"
IfMatchAction=[!SetOption MeterWednesday Hidden 0][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption MeterWednesday Hidden 1][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterThursday]
Meter=String
MeasureName=MeasureDay
Text="THURSDAY"
X=(310*#Scale#)
Y=(0*#Scale#)
FontFace=Anurati
FontSize=(40*#Scale#)
FontColor=#TextColor#
StringAlign=Left
StringCase=Upper
AntiAlias=1
Hidden=1
IfMatch="Thursday"
IfMatchAction=[!SetOption MeterThursday Hidden 0][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption MeterThursday Hidden 1][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterFriday]
Meter=String
MeasureName=MeasureDay
Text="FRIDAY"
X=(330*#Scale#)
Y=(0*#Scale#)
FontFace=Anurati
FontSize=(40*#Scale#)
FontColor=#TextColor#
StringAlign=Left
StringCase=Upper
AntiAlias=1
Hidden=1
IfMatch="Friday"
IfMatchAction=[!SetOption MeterFriday Hidden 0][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption MeterFriday Hidden 1][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterSaturday]
Meter=String
MeasureName=MeasureDay
Text="SATURDAY"
X=(290*#Scale#)
Y=(0*#Scale#)
FontFace=Anurati
FontSize=(40*#Scale#)
FontColor=#TextColor#
StringAlign=Left
StringCase=Upper
AntiAlias=1
Hidden=1
IfMatch="Saturday"
IfMatchAction=[!SetOption MeterSaturday Hidden 0][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption MeterSaturday Hidden 1][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterSunday]
Meter=String
MeasureName=MeasureDay
Text="SUNDAY"
X=(320*#Scale#)
Y=(0*#Scale#)
FontFace=Anurati
FontSize=(40*#Scale#)
FontColor=#TextColor#
StringAlign=Left
StringCase=Upper
AntiAlias=1
Hidden=1
IfMatch="Sunday"
IfMatchAction=[!SetOption MeterSunday Hidden 0][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!SetOption MeterSunday Hidden 1][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterDate]
Meter=String
MeasureName=MeasureDate
StringAlign=Center
StringCase=Upper
FontFace=Quicksand
FontColor=#TextColor#
FontSize=(14*#Scale#)
X=(340*#Scale#)
Y=(75*#Scale#)
Text="%1"
AntiAlias=1
User avatar
balala
Rainmeter Sage
Posts: 16539
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Change widget position depending on the day of the week

Post by balala »

IvanAstran wrote: June 11th, 2024, 8:53 am I have a widget for Rainmeter that shows the days of the week.
No, you don't have a widget, but a skin. In Rainmeter there are no widgets, just skins.
IvanAstran wrote: June 11th, 2024, 8:53 am But each day of the week has a different number of letters, so the word keeps moving out and I have to correct it.
I need to make it so that each day of the week has a different position.
:o :o :o
Don't create seven String meters, one for each day of the week. This is completely useless, wasting lot of space in the code of the skin. Instead one single meter should be created and what I'd do with it is to center it. This way the weekday is kept on the same position. For instance replace the [MeterMonday], [MeterTuesday] (and so on) meters, with the following one:

Code: Select all

[MeterWeekday]
Meter=String
MeasureName=MeasureDay
Text=%1
X=(320*#Scale#)
Y=(0*#Scale#)
FontFace=Anurati
FontSize=(40*#Scale#)
FontColor=#TextColor#
StringAlign=Center
StringCase=Upper
AntiAlias=1
Hidden=0
;IfMatch="Monday"
;IfMatchAction=[!SetOption MeterMonday Hidden 0][!UpdateMeter *][!Redraw]
;IfNotMatchAction=[!SetOption MeterMonday Hidden 1][!UpdateMeter *][!Redraw]
DynamicVariables=1
See what have been replaced:
  • The Text option has been changed to Text=%1. This way, this only meter shows what the [MeasureDay] measure is returning (due to the MeasureName=MeasureDay option of the meter). On the seven meters you had a MeasureName option on each of them, but each shown one day of the week, set by the Text="MONDAY", Text="TUESDAY" (and so on) options (additional tip: quotes are completely useless, they are not needed in Rainmeter).
  • The StringAlign option has been replaced by StringAlign=Center, which obviously centers the string.
  • The IfMatch, IfMatchAction and IfNotMatchAction options have been sommented out, they can be removed freely, because they are not working on meters. These options can be used only on measures, not on meters (I didn't completely removed them, just to let you see they are not allowed).
Besides all this, you have to replace the meter, by altering its X option. I kept above the X=(320*#Scale#) option of the [MeterMonday] meter, but you obviously can place it to a proper position, if this is not good enough.
Is this solution a proper one for your needs?