It is currently March 29th, 2024, 2:25 pm

Help: Switching wallpapers with a button

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help: Switching wallpapers with a button

Post by balala »

Yincognito wrote: June 14th, 2020, 11:13 pm Apart from the size of the .ini files themselves (which is a bit too much for my taste, but then, you probably had your reasons), only your calendar skin takes 6-8% of my CPU. That's about 10 times as much as my entire suite (bar my Audio skin that you know of) - just saying... O.O
Yeah, it might be a little bit too large, but I did it so because I added a lot of features I never saw into a Rainmeter skin. For instance the ability to add events or holidays (by left-, respectively right clicks onto the day you want to add the event to) or the possibility of scrolling the month with the mouse. I tested my skin before I uploaded it and for me didn't take so much CPU usage. I assume on a weaker computer (please don't misunderstand me) this might increase.
Yeah, everybody can decide if want to use my suite or not. I suppose as usually some users are using it, others don't like, don't want or can't use it. Finally it's up to each...
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

balala wrote: June 15th, 2020, 5:19 pm The problem is in the LeftMouseUpAction option of the [MeterButton] meter, which is mistakenly written as LeftMouseAction (instead of LeftMouseUpAction). Add the missing Up term into the name of the option and try again. Does it work?
Yeah perfect, I found teh error by redoing all this part. I really need to be more precise.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help: Switching wallpapers with a button

Post by balala »

Mino_el_Nukenin wrote: June 15th, 2020, 6:10 pm I really need to be more precise.
Yeah, this always helps. But don't worry, it happens to all of us from time to time.
User avatar
Yincognito
Rainmeter Sage
Posts: 7030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

balala wrote: June 15th, 2020, 5:27 pm Yeah, it might be a little bit too large, but I did it so because I added a lot of features I never saw into a Rainmeter skin. For instance the ability to add events or holidays (by left-, respectively right clicks onto the day you want to add the event to) or the possibility of scrolling the month with the mouse. I tested my skin before I uploaded it and for me didn't take so much CPU usage. I assume on a weaker computer (please don't misunderstand me) this might increase.
Yeah, everybody can decide if want to use my suite or not. I suppose as usually some users are using it, others don't like, don't want or can't use it. Finally it's up to each...
I'm all for the features you added to your skin, I think they're great, but that's not the issue. In my view all this could have been done using way less code and way less CPU (even when idle, not just when adding events). Of course, I wouldn't dare to tell you how to approach things in your skin (so please don't misunderstand me either), but both adding events and scrolling the month(s), could have been achieved easier if the month was a single string meter that you could then tweak it using inline settings on individual days and react on it either using the mouse variables if you only needed click reaction, or a plugin like MouseXY (I saw a mouse plugin in there, not sure if it was the same) if you needed hover reaction as well. Therefore, less code, less CPU usage. Even the way you did it (which is by no means wrong or anything like that), it shouldn't take that amount of resources on idle (i.e. no animation, no hover, no event or holidays added, etc). Anyway, that's just my take on the whole process from a technical point of view, and that doesn't conflict in any way with my impression that you've done a great job in terms of visuals and functionality / features in your skin(s).
Mino_el_Nukenin wrote: June 15th, 2020, 12:40 pm
EDIT:
So I've just went through both of your skins but it's way too complicated to understand. Too much code and too many fonctions I don't really need... I got lost in all of it.
It may be a bit complicated to understand, yes, but that's inherent to a calendar skin - you have to have a few formulas here and there to handle the particularities of a calendar, you know. I can't speak for balala, but in my example, except probably the spaces before or after the weekdays, there's absolutely nothing that isn't needed for a month calendar to work. In my view, just 375 lines of Rainmeter code (of which a significant part is just repetitive) in a 30 kb ini file isn't that much for a fully functional month calendar skin that can scroll to whatever month in the 1 AD to 9999 AD interval (and that's just because I wanted to limit the year to max 4 digits, LOL).

Bottom line, you'd have to use such sligthly complicated code for a calendar skin, whether you take an already made code like a Lua script and such from some place else, or you do it as an original work. There's no other way when it comes to calendars.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help: Switching wallpapers with a button

Post by balala »

Yincognito wrote: June 15th, 2020, 6:35 pm I'm all for the features you added to your skin, I think they're great, but that's not the issue. In my view all this could have been done using way less code and way less CPU (even when idle, not just when adding events). Of course, I wouldn't dare to tell you how to approach things in your skin (so please don't misunderstand me either), but both adding events and scrolling the month(s), could have been achieved easier if the month was a single string meter that you could then tweak it using inline settings on individual days and react on it either using the mouse variables if you only needed click reaction, or a plugin like MouseXY (I saw a mouse plugin in there, not sure if it was the same) if you needed hover reaction as well. Therefore, less code, less CPU usage. Even the way you did it (which is by no means wrong or anything like that), it shouldn't take that amount of resources on idle (i.e. no animation, no hover, no event or holidays added, etc). Anyway, that's just my take on the whole process from a technical point of view, and that doesn't conflict in any way with my impression that you've done a great job in terms of visuals and functionality / features in your skin(s).
Thanks for the appreciations, mean a lot.
About the way I did it, as usually there are more way to achieve the same result. When I wrote the skin this is how I found the solutions to different things, but that was a few years back now. Yes, taking into account your suggestions, in future I might try to rewrite the whole code, but this is left as a future project. But anyway, it worth to think about it and I will.
User avatar
Yincognito
Rainmeter Sage
Posts: 7030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

balala wrote: June 15th, 2020, 6:45 pm Thanks for the appreciations, mean a lot.
About the way I did it, as usually there are more way to achieve the same result. When I wrote the skin this is how I found the solutions to different things, but that was a few years back now. Yes, taking into account your suggestions, in future I might try to rewrite the whole code, but this is left as a future project. But anyway, it worth to think about it and I will.
I didn't imply that you'd have to consider rewriting the code, even as a future project - it was just a discussion about the pros and cons of the code, that's all. But yeah, thinking about something never hurts. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help: Switching wallpapers with a button

Post by balala »

Yincognito wrote: June 15th, 2020, 7:58 pm But yeah, thinking about something never hurts. ;-)
:thumbup: Completely agree...
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help: Switching wallpapers with a button

Post by balala »

Mino_el_Nukenin wrote: June 15th, 2020, 12:40 pm Actually the only part I need are the numbers of the days in the calendar and have it automatic accordingly to the current month all the rest is already done.
Still interested into the above "days problem"? If you are, here is a first step, done with simple Rainmeter code. I added a lot of meters and a few measures to the code of Calendar\Calendar.ini, here is what I got:

Code: Select all

[Rainmeter]
Update=1000
SkinWidth=250
SkinHeight=160
AccurateText=1
Group=Module

[Metadata]
Name= Calendar
Author=Fonpaolo | Mino
Information= Displays a calendar | Show day of the week | Show year | Show week number | Show day number of the year
Version=3
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
@include=#@#\Config.inc
MyVar=0
MonthCount=0
MouseAction0=[!SetVariable MyVar "1"][!UpdateMeasure "MeasureMyVar"][!Redraw][!ShowMeterGroup "Calendar"][!ShowMeterGroup Calendar]
MouseAction1=[!SetVariable MyVar "0"][!UpdateMeasure "MeasureMyVar"][!Redraw][!HideMeterGroup "Calendar"][!HideMeterGroup Calendar]

[DayStringStyle]
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,1
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=CenterCenter
AntiAlias=1
Hidden=1
Group=Calendar
UpdateDivider=-1

;=== TEXT STYLES ===================================================

[TextStyleWeekDay]
Meter=String
FontColor=255,255,255,200
FontFace=OCR A Extended
FontSize=11
StringAlign=Center
StringEffect=Shadow
FontEffectColor=0,0,0,100
AntiAlias=1

[TextStyleYear]
Meter=String
FontColor=255,255,255,200
FontFace=OCR A Extended
FontSize=14
StringAlign=Center
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,100
AntiAlias=1

[TextStyleWeekNumber]
Meter=String
FontColor=255,255,255,200
FontFace=OCR A Extended
FontSize=10
StringAlign=Center
StringEffect=Shadow
FontEffectColor=0,0,0,100
AntiAlias=1

[TextStyleDayNumber]
Meter=String
FontColor=255,255,255,200
FontFace=OCR A Extended
FontSize=10
StringAlign=Center
StringEffect=Shadow
FontEffectColor=0,0,0,100
AntiAlias=1

;=== MEASURES ======================================================
;--- Measure Button ------------------------------------------------
[MeasureMyVar]
Measure=Calc
Formula=#MyVar#
IfCondition=(#CURRENTSECTION#=1)
UpdateDivider=-1
DynamicVariables=1

;--- Measure Year --------------------------------------------------
[MeasureYear]
Measure=Time
Format=%Y
UpdateDivider=-1

;--- Measure Week of the year Number -------------------------------

[MeasureWeekNumber]
Measure=Time
Format=%V
UpdateDivider=-1

;--- Measure Day of the year Number -------------------------------
[MeasureDayNumber]
Measure=Time
Format=%#j
UpdateDivider=-1

;=== METERS ========================================================
;--- Meter Calendar Background -------------------------------------

[MeterCalendar]
Meter=Image
ImageName=#@#\Images\Calendar\Calendar.png
Y=5
Antialias=1
DynamicVariables=1
Hidden=1
Group=Calendar

;--- Meter Main Button ---------------------------------------------

[MeterImage]
Meter=Button
ButtonImage=#@#\Images\Calendar\Button #MyVar#.png
X=219r
Y=-4r
Antialias=1
LeftMouseUpAction=[#MouseAction[#MyVar]]
DynamicVariables=1

;--- Meters Weekdays -----------------------------------------------

[MeterLabelWeekDay1]
Meter=String
MeterStyle=TextStyleWeekDay
x=30
y=30
Text="Mo"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay2]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="Tu"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay3]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="We"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay4]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="Th"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay5]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="Fr"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay6]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="Sa"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay7]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="Su"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

;--- Meter Year -----------------------------------------------

[MeterYear]
Meter=String
Measurename=MeasureYear
MeterStyle=TextStyleYear
x=194
y=43
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

;--- Meters Week of year Number---------------------------

[MeterWeekNumber]
Meter=String
MeterStyle=TextStyleWeekNumber
x=186
y=72
Group=Calendar
Text="Week"
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterWeekNumber2]
Meter=String
Measurename=MeasureWeekNumber
MeterStyle=TextStyleWeekNumber
x=28r
y=r
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

;--- Meters Day of year Number---------------------------

[MeterDayNumber]
Meter=String
MeterStyle=TextStyleDayNumber
x=182
y=98
Group=Calendar
Text="Day"
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterDayNumber2]
Meter=String
Measurename=MeasureDayNumber
MeterStyle=TextStyleDayNumber
x=28r
y=r
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeasureMonth]
Measure=Time
Format=%m

[MeasureDay1]
Measure=Time
Format=%u
TimeStamp=[MeasureYear]-[MeasureMonth]-01
TimeStampFormat=%Y-%m-%d
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!SetOption MeterW1D1 Text "1"][!SetOption MeterW1D2 Text "2"][!SetOption MeterW1D3 Text "3"][!SetOption MeterW1D4 Text "4"][!SetOption MeterW1D5 Text "5"][!SetOption MeterW1D6 Text "6"][!SetOption MeterW1D7 Text "7"][!SetOption MeterW2D1 Text "8"][!SetOption MeterW2D2 Text "9"][!SetOption MeterW2D3 Text "10"][!SetOption MeterW2D4 Text "11"][!SetOption MeterW2D5 Text "12"][!SetOption MeterW2D6 Text "13"][!SetOption MeterW2D7 Text "14"][!SetOption MeterW3D1 Text "15"][!SetOption MeterW3D2 Text "16"][!SetOption MeterW3D3 Text "17"][!SetOption MeterW3D4 Text "18"][!SetOption MeterW3D5 Text "19"][!SetOption MeterW3D6 Text "20"][!SetOption MeterW3D7 Text "21"][!SetOption MeterW4D1 Text "22"][!SetOption MeterW4D2 Text "23"][!SetOption MeterW4D3 Text "24"][!SetOption MeterW4D4 Text "25"][!SetOption MeterW4D5 Text "26"][!SetOption MeterW4D6 Text "27"][!SetOption MeterW4D7 Text "28"][!SetOption MeterW5D1 Text "29"][!SetOption MeterW5D2 Text "30"][!SetOption MeterW5D3 Text "31"][!SetOption MeterW5D4 Text ""][!SetOption MeterW5D5 Text ""][!SetOption MeterW5D6 Text ""][!SetOption MeterW5D7 Text ""][!SetOption MeterW6D1 Text ""][!SetOption MeterW6D2 Text ""][!SetOption MeterW6D3 Text ""][!SetOption MeterW6D4 Text ""][!SetOption MeterW6D5 Text ""][!SetOption MeterW6D6 Text ""][!SetOption MeterW6D7 Text ""][!UpdateMeterGroup "Calendar"][!Redraw]
IfCondition2=(#CURRENTSECTION#=2)
IfTrueAction2=[!SetOption MeterW1D1 Text ""][!SetOption MeterW1D2 Text "1"][!SetOption MeterW1D3 Text "2"][!SetOption MeterW1D4 Text "3"][!SetOption MeterW1D5 Text "4"][!SetOption MeterW1D6 Text "5"][!SetOption MeterW1D7 Text "6"][!SetOption MeterW2D1 Text "7"][!SetOption MeterW2D2 Text "8"][!SetOption MeterW2D3 Text "9"][!SetOption MeterW2D4 Text "10"][!SetOption MeterW2D5 Text "11"][!SetOption MeterW2D6 Text "12"][!SetOption MeterW2D7 Text "13"][!SetOption MeterW3D1 Text "14"][!SetOption MeterW3D2 Text "15"][!SetOption MeterW3D3 Text "16"][!SetOption MeterW3D4 Text "17"][!SetOption MeterW3D5 Text "18"][!SetOption MeterW3D6 Text "19"][!SetOption MeterW3D7 Text "20"][!SetOption MeterW4D1 Text "21"][!SetOption MeterW4D2 Text "22"][!SetOption MeterW4D3 Text "23"][!SetOption MeterW4D4 Text "24"][!SetOption MeterW4D5 Text "25"][!SetOption MeterW4D6 Text "26"][!SetOption MeterW4D7 Text "27"][!SetOption MeterW5D1 Text "28"][!SetOption MeterW5D2 Text "29"][!SetOption MeterW5D3 Text "30"][!SetOption MeterW5D4 Text "31"][!SetOption MeterW5D5 Text ""][!SetOption MeterW5D6 Text ""][!SetOption MeterW5D7 Text ""][!SetOption MeterW6D1 Text ""][!SetOption MeterW6D2 Text ""][!SetOption MeterW6D3 Text ""][!SetOption MeterW6D4 Text ""][!SetOption MeterW6D5 Text ""][!SetOption MeterW6D6 Text ""][!SetOption MeterW6D7 Text ""][!UpdateMeterGroup "Calendar"][!Redraw]
IfCondition3=(#CURRENTSECTION#=3)
IfTrueAction3=[!SetOption MeterW1D1 Text ""][!SetOption MeterW1D2 Text ""][!SetOption MeterW1D3 Text "1"][!SetOption MeterW1D4 Text "2"][!SetOption MeterW1D5 Text "3"][!SetOption MeterW1D6 Text "4"][!SetOption MeterW1D7 Text "5"][!SetOption MeterW2D1 Text "6"][!SetOption MeterW2D2 Text "7"][!SetOption MeterW2D3 Text "8"][!SetOption MeterW2D4 Text "9"][!SetOption MeterW2D5 Text "10"][!SetOption MeterW2D6 Text "11"][!SetOption MeterW2D7 Text "12"][!SetOption MeterW3D1 Text "13"][!SetOption MeterW3D2 Text "14"][!SetOption MeterW3D3 Text "15"][!SetOption MeterW3D4 Text "16"][!SetOption MeterW3D5 Text "17"][!SetOption MeterW3D6 Text "18"][!SetOption MeterW3D7 Text "19"][!SetOption MeterW4D1 Text "20"][!SetOption MeterW4D2 Text "21"][!SetOption MeterW4D3 Text "22"][!SetOption MeterW4D4 Text "23"][!SetOption MeterW4D5 Text "24"][!SetOption MeterW4D6 Text "25"][!SetOption MeterW4D7 Text "26"][!SetOption MeterW5D1 Text "27"][!SetOption MeterW5D2 Text "28"][!SetOption MeterW5D3 Text "29"][!SetOption MeterW5D4 Text "30"][!SetOption MeterW5D5 Text "31"][!SetOption MeterW5D6 Text ""][!SetOption MeterW5D7 Text ""][!SetOption MeterW6D1 Text ""][!SetOption MeterW6D2 Text ""][!SetOption MeterW6D3 Text ""][!SetOption MeterW6D4 Text ""][!SetOption MeterW6D5 Text ""][!SetOption MeterW6D6 Text ""][!SetOption MeterW6D7 Text ""][!UpdateMeterGroup "Calendar"][!Redraw]
IfCondition4=(#CURRENTSECTION#=4)
IfTrueAction4=[!SetOption MeterW1D1 Text ""][!SetOption MeterW1D2 Text ""][!SetOption MeterW1D3 Text ""][!SetOption MeterW1D4 Text "1"][!SetOption MeterW1D5 Text "2"][!SetOption MeterW1D6 Text "3"][!SetOption MeterW1D7 Text "4"][!SetOption MeterW2D1 Text "5"][!SetOption MeterW2D2 Text "6"][!SetOption MeterW2D3 Text "7"][!SetOption MeterW2D4 Text "8"][!SetOption MeterW2D5 Text "9"][!SetOption MeterW2D6 Text "10"][!SetOption MeterW2D7 Text "11"][!SetOption MeterW3D1 Text "12"][!SetOption MeterW3D2 Text "13"][!SetOption MeterW3D3 Text "14"][!SetOption MeterW3D4 Text "15"][!SetOption MeterW3D5 Text "16"][!SetOption MeterW3D6 Text "17"][!SetOption MeterW3D7 Text "18"][!SetOption MeterW4D1 Text "19"][!SetOption MeterW4D2 Text "20"][!SetOption MeterW4D3 Text "21"][!SetOption MeterW4D4 Text "22"][!SetOption MeterW4D5 Text "23"][!SetOption MeterW4D6 Text "24"][!SetOption MeterW4D7 Text "25"][!SetOption MeterW5D1 Text "26"][!SetOption MeterW5D2 Text "27"][!SetOption MeterW5D3 Text "28"][!SetOption MeterW5D4 Text "29"][!SetOption MeterW5D5 Text "30"][!SetOption MeterW5D6 Text "31"][!SetOption MeterW5D7 Text ""][!SetOption MeterW6D1 Text ""][!SetOption MeterW6D2 Text ""][!SetOption MeterW6D3 Text ""][!SetOption MeterW6D4 Text ""][!SetOption MeterW6D5 Text ""][!SetOption MeterW6D6 Text ""][!SetOption MeterW6D7 Text ""][!UpdateMeterGroup "Calendar"][!Redraw]
IfCondition5=(#CURRENTSECTION#=5)
IfTrueAction5=[!SetOption MeterW1D1 Text ""][!SetOption MeterW1D2 Text ""][!SetOption MeterW1D3 Text ""][!SetOption MeterW1D4 Text ""][!SetOption MeterW1D5 Text "1"][!SetOption MeterW1D6 Text "2"][!SetOption MeterW1D7 Text "3"][!SetOption MeterW2D1 Text "4"][!SetOption MeterW2D2 Text "5"][!SetOption MeterW2D3 Text "6"][!SetOption MeterW2D4 Text "7"][!SetOption MeterW2D5 Text "8"][!SetOption MeterW2D6 Text "9"][!SetOption MeterW2D7 Text "10"][!SetOption MeterW3D1 Text "11"][!SetOption MeterW3D2 Text "12"][!SetOption MeterW3D3 Text "13"][!SetOption MeterW3D4 Text "14"][!SetOption MeterW3D5 Text "15"][!SetOption MeterW3D6 Text "16"][!SetOption MeterW3D7 Text "17"][!SetOption MeterW4D1 Text "18"][!SetOption MeterW4D2 Text "19"][!SetOption MeterW4D3 Text "20"][!SetOption MeterW4D4 Text "21"][!SetOption MeterW4D5 Text "22"][!SetOption MeterW4D6 Text "23"][!SetOption MeterW4D7 Text "24"][!SetOption MeterW5D1 Text "25"][!SetOption MeterW5D2 Text "26"][!SetOption MeterW5D3 Text "27"][!SetOption MeterW5D4 Text "28"][!SetOption MeterW5D5 Text "29"][!SetOption MeterW5D6 Text "30"][!SetOption MeterW5D7 Text "31"][!SetOption MeterW6D1 Text ""][!SetOption MeterW6D2 Text ""][!SetOption MeterW6D3 Text ""][!SetOption MeterW6D4 Text ""][!SetOption MeterW6D5 Text ""][!SetOption MeterW6D6 Text ""][!SetOption MeterW6D7 Text ""][!UpdateMeterGroup "Calendar"][!Redraw]
IfCondition6=(#CURRENTSECTION#=6)
IfTrueAction6=[!SetOption MeterW1D1 Text ""][!SetOption MeterW1D2 Text ""][!SetOption MeterW1D3 Text ""][!SetOption MeterW1D4 Text ""][!SetOption MeterW1D5 Text ""][!SetOption MeterW1D6 Text "1"][!SetOption MeterW1D7 Text "2"][!SetOption MeterW2D1 Text "3"][!SetOption MeterW2D2 Text "4"][!SetOption MeterW2D3 Text "5"][!SetOption MeterW2D4 Text "6"][!SetOption MeterW2D5 Text "7"][!SetOption MeterW2D6 Text "8"][!SetOption MeterW2D7 Text "9"][!SetOption MeterW3D1 Text "10"][!SetOption MeterW3D2 Text "11"][!SetOption MeterW3D3 Text "12"][!SetOption MeterW3D4 Text "13"][!SetOption MeterW3D5 Text "14"][!SetOption MeterW3D6 Text "15"][!SetOption MeterW3D7 Text "16"][!SetOption MeterW4D1 Text "17"][!SetOption MeterW4D2 Text "18"][!SetOption MeterW4D3 Text "19"][!SetOption MeterW4D4 Text "20"][!SetOption MeterW4D5 Text "21"][!SetOption MeterW4D6 Text "22"][!SetOption MeterW4D7 Text "23"][!SetOption MeterW5D1 Text "24"][!SetOption MeterW5D2 Text "25"][!SetOption MeterW5D3 Text "26"][!SetOption MeterW5D4 Text "27"][!SetOption MeterW5D5 Text "28"][!SetOption MeterW5D6 Text "29"][!SetOption MeterW5D7 Text "30"][!SetOption MeterW6D1 Text "31"][!SetOption MeterW6D2 Text ""][!SetOption MeterW6D3 Text ""][!SetOption MeterW6D4 Text ""][!SetOption MeterW6D5 Text ""][!SetOption MeterW6D6 Text ""][!SetOption MeterW6D7 Text ""][!UpdateMeterGroup "Calendar"][!Redraw]
IfCondition7=(#CURRENTSECTION#=7)
IfTrueAction7=[!SetOption MeterW1D1 Text ""][!SetOption MeterW1D2 Text ""][!SetOption MeterW1D3 Text ""][!SetOption MeterW1D4 Text ""][!SetOption MeterW1D5 Text ""][!SetOption MeterW1D6 Text ""][!SetOption MeterW1D7 Text "1"][!SetOption MeterW2D1 Text "2"][!SetOption MeterW2D2 Text "3"][!SetOption MeterW2D3 Text "4"][!SetOption MeterW2D4 Text "5"][!SetOption MeterW2D5 Text "6"][!SetOption MeterW2D6 Text "7"][!SetOption MeterW2D7 Text "8"][!SetOption MeterW3D1 Text "9"][!SetOption MeterW3D2 Text "10"][!SetOption MeterW3D3 Text "11"][!SetOption MeterW3D4 Text "12"][!SetOption MeterW3D5 Text "13"][!SetOption MeterW3D6 Text "14"][!SetOption MeterW3D7 Text "15"][!SetOption MeterW4D1 Text "16"][!SetOption MeterW4D2 Text "17"][!SetOption MeterW4D3 Text "18"][!SetOption MeterW4D4 Text "19"][!SetOption MeterW4D5 Text "20"][!SetOption MeterW4D6 Text "21"][!SetOption MeterW4D7 Text "22"][!SetOption MeterW5D1 Text "23"][!SetOption MeterW5D2 Text "24"][!SetOption MeterW5D3 Text "25"][!SetOption MeterW5D4 Text "26"][!SetOption MeterW5D5 Text "27"][!SetOption MeterW5D6 Text "28"][!SetOption MeterW5D7 Text "29"][!SetOption MeterW6D1 Text "30"][!SetOption MeterW6D2 Text "31"][!SetOption MeterW6D3 Text ""][!SetOption MeterW6D4 Text ""][!SetOption MeterW6D5 Text ""][!SetOption MeterW6D6 Text ""][!SetOption MeterW6D7 Text ""][!UpdateMeterGroup "Calendar"][!Redraw]
DynamicVariables=1

[MeterW1D1]
Meter=STRING
MeterStyle=DayStringStyle
X=28
Y=52

[MeterW1D2]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW1D3]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW1D4]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW1D5]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW1D6]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW1D7]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW2D1]
Meter=STRING
MeterStyle=DayStringStyle
X=-126r
Y=17r

[MeterW2D2]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW2D3]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW2D4]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW2D5]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW2D6]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW2D7]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW3D1]
Meter=STRING
MeterStyle=DayStringStyle
X=-126r
Y=17r

[MeterW3D2]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW3D3]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW3D4]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW3D5]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW3D6]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW3D7]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW4D1]
Meter=STRING
MeterStyle=DayStringStyle
X=-126r
Y=17r

[MeterW4D2]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW4D3]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW4D4]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW4D5]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW4D6]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW4D7]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW5D1]
Meter=STRING
MeterStyle=DayStringStyle
X=-126r
Y=17r

[MeterW5D2]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r
Text=30

[MeterW5D3]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW5D4]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW5D5]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW5D6]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW5D7]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW6D1]
Meter=STRING
MeterStyle=DayStringStyle
X=-126r
Y=17r

[MeterW6D2]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW6D3]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW6D4]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW6D5]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW6D6]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r

[MeterW6D7]
Meter=STRING
MeterStyle=DayStringStyle
X=21r
Y=0r
Note that with this code all month are shown with 31 days. There is further work with setting the appropriate length for months, but before I start working with it, please check the above code and let me know if it does what you are waiting for.
User avatar
Yincognito
Rainmeter Sage
Posts: 7030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Help: Switching wallpapers with a button

Post by Yincognito »

Sample using my approach (advantage: lesser code, a single month meter; disadvantage: works best with monospaced fonts or font where there is the width of digits is the same and can be expressed as an integral number of spaces, may need spacing adjustments) - based on your last uploaded skin code:

Code: Select all

[Rainmeter]
Update=1000
SkinWidth=250
SkinHeight=160
AccurateText=1
Group=Module

[Metadata]
Name= Calendar
Author=Fonpaolo | Mino
Information= Displays a calendar | Show day of the week | Show year | Show week number | Show day number of the year
Version=3
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
@include=#@#\Config.inc
MyVar=0
MonthCount=0
MouseAction0=[!SetVariable MyVar "1"][!UpdateMeasure "MeasureMyVar"][!Redraw][!ShowMeter "MeterCalendar"][!ShowMeterGroup Calendar]
MouseAction1=[!SetVariable MyVar "0"][!UpdateMeasure "MeasureMyVar"][!Redraw][!HideMeter "MeterCalendar"][!HideMeterGroup Calendar]

WeekStartDay=1
MonthString="01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 "
BlankWeekString="00 00 00 00 00 00 00 "
MarkedDayNumber=" 00 "

;=== TEXT STYLES ===================================================

[TextStyleWeekDay]
Meter=String
FontColor=255,255,255,200
FontFace=OCR A Extended
FontSize=11
StringAlign=Center
StringEffect=Shadow
FontEffectColor=0,0,0,100
AntiAlias=1

[TextStyleYear]
Meter=String
FontColor=255,255,255,200
FontFace=OCR A Extended
FontSize=14
StringAlign=Center
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,100
AntiAlias=1

[TextStyleWeekNumber]
Meter=String
FontColor=255,255,255,200
FontFace=OCR A Extended
FontSize=10
StringAlign=Center
StringEffect=Shadow
FontEffectColor=0,0,0,100
AntiAlias=1

[TextStyleDayNumber]
Meter=String
FontColor=255,255,255,200
FontFace=OCR A Extended
FontSize=10
StringAlign=Center
StringEffect=Shadow
FontEffectColor=0,0,0,100
AntiAlias=1

[TextStyleMonthDayNumbers]
Meter=String
FontColor=255,255,255,200
FontFace=Consolas
FontSize=11
StringEffect=Shadow
FontEffectColor=0,0,0,100
AntiAlias=1

;=== MEASURES ======================================================
;--- Measure Button ------------------------------------------------
[MeasureMyVar]
Measure=Calc
Formula=#MyVar#
IfCondition=(#CURRENTSECTION#=1)
UpdateDivider=-1
DynamicVariables=1

;--- Measure Year --------------------------------------------------
[MeasureYear]
Measure=Time
Format=%Y
UpdateDivider=-1

;--- Measure Week of the year Number -------------------------------

[MeasureWeekNumber]
Measure=Time
Format=%V
UpdateDivider=-1

;--- Measure Day of the year Number -------------------------------
[MeasureDayNumber]
Measure=Time
Format=%#j
UpdateDivider=-1

;--- Measures Calendar -------------------------------
[MS_Rainmeter_CurrentDayNumber]
Measure=Time
Format=%d
OnUpdateAction=[!SetVariable MarkedDayNumber " [MS_Rainmeter_CurrentDayNumber] "]

[MS_Rainmeter_ActiveMonthYearNumber]
Measure=Time
Format=%Y

[MS_Rainmeter_ActiveMonthNumber]
Measure=Time
Format=%m

[MS_Rainmeter_ActiveMonthDays]
Measure=Calc
Formula=((MS_Rainmeter_ActiveMonthNumber=1)||(MS_Rainmeter_ActiveMonthNumber=3)||(MS_Rainmeter_ActiveMonthNumber=5)||(MS_Rainmeter_ActiveMonthNumber=7)||(MS_Rainmeter_ActiveMonthNumber=8)||(MS_Rainmeter_ActiveMonthNumber=10)||(MS_Rainmeter_ActiveMonthNumber=12)?31:((MS_Rainmeter_ActiveMonthNumber=4)||(MS_Rainmeter_ActiveMonthNumber=6)||(MS_Rainmeter_ActiveMonthNumber=9)||(MS_Rainmeter_ActiveMonthNumber=11)?30:(((MS_Rainmeter_ActiveMonthYearNumber%4=0)&&(MS_Rainmeter_ActiveMonthYearNumber%100<>0))||(MS_Rainmeter_ActiveMonthYearNumber%400=0)?29:28)))
UpdateDivider=-1

; Formula below based on Zeller's Congruence

[MS_Rainmeter_ActiveMonthDay1WeekdayNumber]
Measure=Calc
Formula=((1+Floor((((MS_Rainmeter_ActiveMonthNumber=1?13:(MS_Rainmeter_ActiveMonthNumber=2?14:MS_Rainmeter_ActiveMonthNumber))+1)*26)/10)+(MS_Rainmeter_ActiveMonthNumber<3?(MS_Rainmeter_ActiveMonthYearNumber-1):MS_Rainmeter_ActiveMonthYearNumber)+Floor((MS_Rainmeter_ActiveMonthNumber<3?(MS_Rainmeter_ActiveMonthYearNumber-1):MS_Rainmeter_ActiveMonthYearNumber)/4)+6*Floor((MS_Rainmeter_ActiveMonthNumber<3?(MS_Rainmeter_ActiveMonthYearNumber-1):MS_Rainmeter_ActiveMonthYearNumber)/100)+Floor((MS_Rainmeter_ActiveMonthNumber<3?(MS_Rainmeter_ActiveMonthYearNumber-1):MS_Rainmeter_ActiveMonthYearNumber)/400))%7+6)%7
UpdateDivider=-1

; Formula above based on Zeller's Congruence

[MS_Rainmeter_ActiveMonthDaysBetweenWeekStartDayAndDay1]
Measure=Calc
Formula=((7+MS_Rainmeter_ActiveMonthDay1WeekdayNumber-#WeekStartDay#)%7)
OnUpdateAction=[!SetVariable ActiveMonthDaysBetweenWeekStartDayAndDay1 [MS_Rainmeter_ActiveMonthDaysBetweenWeekStartDayAndDay1]]
UpdateDivider=-1

[MS_Rainmeter_ActiveMonthDaysBetweenWeekStartDayAndLastDay]
Measure=Calc
Formula=(MS_Rainmeter_ActiveMonthDaysBetweenWeekStartDayAndDay1+MS_Rainmeter_ActiveMonthDays)
OnUpdateAction=[!SetVariable ActiveMonthDaysBetweenWeekStartDayAndLastDay [MS_Rainmeter_ActiveMonthDaysBetweenWeekStartDayAndLastDay]]
UpdateDivider=-1

[MS_Rainmeter_ActiveMonthString]
Measure=String
String=#MonthString#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="([^\d][MS_Rainmeter_ActiveMonthDays] ).*$":"\1","^(.*)$":"#BlankWeekString#\1","^.*((\d{2} ){#ActiveMonthDaysBetweenWeekStartDayAndLastDay#})$":"\1","((\d+ ){7})":" \1#CRLF#","\n$":""," ":" "," *\n *":" #CRLF#  ","(^ *| *$)":"  ","(#MarkedDayNumber#)":"[\x200B]\1[\x200B]"," 00":"   "," 0":"  "
DynamicVariables=1

;=== METERS ========================================================
;--- Meter Calendar Background -------------------------------------

[MeterCalendar]
Meter=Image
ImageName=#@#\Images\Calendar\Calendar.png
Y=5
Antialias=1
DynamicVariables=1
Hidden=1

;--- Meter Main Button ---------------------------------------------

[MeterImage]
Meter=Button
ButtonImage=#@#\Images\Calendar\Button #MyVar#.png
X=219r
Y=-4r
Antialias=1
LeftMouseUpAction=[#MouseAction[#MyVar]]
DynamicVariables=1

;--- Meters Weekdays -----------------------------------------------

[MeterLabelWeekDay1]
Meter=String
MeterStyle=TextStyleWeekDay
x=30
y=27
Text="Mo"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay2]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="Tu"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay3]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="We"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay4]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="Th"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay5]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="Fr"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay6]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="Sa"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterLabelWeekDay7]
Meter=String
MeterStyle=TextStyleWeekDay
x=21r
y=0r
Text="Su"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MT_Rainmeter_ActiveMonthString]
Meter=String
MeasureName=MS_Rainmeter_ActiveMonthString
MeterStyle=TextStyleMonthDayNumbers
x=8
y=47
Text="%1"
InlineSetting=CharacterSpacing | 0 | -0.75
InlineSetting2=Color | 255,224,128,255
InlinePattern2="(?siU)[\x200B]([^[\x200B]\n]*)[\x200B]"
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

;--- Meter Year -----------------------------------------------

[MeterYear]
Meter=String
Measurename=MeasureYear
MeterStyle=TextStyleYear
x=194
y=43
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

;--- Meters Week of year Number---------------------------

[MeterWeekNumber]
Meter=String
MeterStyle=TextStyleWeekNumber
x=186
y=72
Group=Calendar
Text="Week"
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterWeekNumber2]
Meter=String
Measurename=MeasureWeekNumber
MeterStyle=TextStyleWeekNumber
x=28r
y=r
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1

;--- Meters Day of year Number---------------------------

[MeterDayNumber]
Meter=String
MeterStyle=TextStyleDayNumber
x=182
y=98
Group=Calendar
Text="Day"
UpdateDivider=-1
DynamicVariables=1
Hidden=1

[MeterDayNumber2]
Meter=String
Measurename=MeasureDayNumber
MeterStyle=TextStyleDayNumber
x=28r
y=r
Group=Calendar
UpdateDivider=-1
DynamicVariables=1
Hidden=1
Result:
June 2020 (with today being marked):
June 2020.jpg
August 2020:
August 2020.jpg
The additional code is around 80 lines, with only 2 formulas (didn't add the month name, that's on you). That being said, if you want to have the font and its size unrestricted, you might want to go step by step with balala. This is meant to be a demonstration that it's not as complicated as you thought it was (assuming you have the needed formulas).
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Mino_el_Nukenin
Posts: 231
Joined: April 24th, 2020, 7:39 pm
Location: France

Re: Help: Switching wallpapers with a button

Post by Mino_el_Nukenin »

Yincognito wrote: June 15th, 2020, 6:35 pm
It may be a bit complicated to understand, yes, but that's inherent to a calendar skin - you have to have a few formulas here and there to handle the particularities of a calendar, you know. I can't speak for balala, but in my example, except probably the spaces before or after the weekdays, there's absolutely nothing that isn't needed for a month calendar to work. In my view, just 375 lines of Rainmeter code (of which a significant part is just repetitive) in a 30 kb ini file isn't that much for a fully functional month calendar skin that can scroll to whatever month in the 1 AD to 9999 AD interval (and that's just because I wanted to limit the year to max 4 digits, LOL).

Bottom line, you'd have to use such sligthly complicated code for a calendar skin, whether you take an already made code like a Lua script and such from some place else, or you do it as an original work. There's no other way when it comes to calendars.
Yeah I see. First I tried to use the initial code from another suite i'm using codes, but I got stuck and overflooded by the it : could find what part of teh code I needed for mine.
And as I see yours codes it's indeed not a common an easy code to handle.
I'll let that for a moment and concentrate on other skins I can handle solo for now.

So far I have the whole design and some features I wanted (year/ week of the year number / day of the year number) and the weekdays.
As you can see in the pic : I still need the most important part, the days number.

EDIT: I4ve just seen both your codes propositions, I'll test them and get back to you.
You do not have the required permissions to view the files attached to this post.