It is currently November 18th, 2018, 11:44 pm

Time- based Wallpaper Changer: Change Hour

Help with creating, editing & fixing problems with skins
JohnSmithESP
Posts: 7
Joined: June 15th, 2018, 2:10 pm

Time- based Wallpaper Changer: Change Hour

JohnSmithESP » September 11th, 2018, 8:37 pm

Hi guys, Im editing the Simplon Suite and I have a little problem
Im trying to change hour when wallpaper changes and when I changed the wallpaper doesnt
Actual time: 22:40
Default time to change wallpaper: 00:00
What I want: 21:00
Sorry for my english, Im not native speaker, and thanks in advance

Code: Select all

[Rainmeter]
Update=1000
Author=Connect-R

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

[MeasureTime]
Measure=Time
Format=%H

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

[MeasureConvertNum]
Measure=Calc
Formula=MeasureTime
IfCondition=(MeasureConvertNum >= 21) && (MeasureConvertNum < 06)
;Default:(MeasureConvertNum >= 00) && (MeasureConvertNum < 06)
IfTrueAction=!Execute [!SetWallpaper "#@#TimeOfDayWall/Night.jpg"]
IfCondition2=(MeasureConvertNum >= 06) && (MeasureConvertNum < 12)
IfTrueAction2=!Execute [!SetWallpaper "#@#TimeOfDayWall/Morning.jpg"]
IfCondition3=(MeasureConvertNum >= 12) && (MeasureConvertNum < 18)
IfTrueAction3=!Execute [!SetWallpaper "#@#TimeOfDayWall/Afternoon.jpg"]
IfCondition4=(MeasureConvertNum >= 18)
IfTrueAction4=!Execute [!SetWallpaper "#@#TimeOfDayWall/Evening.jpg"]

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

[MeterDummy]
Meter=String
UpdateDivider-1
Last edited by JohnSmithESP on September 13th, 2018, 7:09 pm, edited 2 times in total.
JohnSmithESP
Posts: 7
Joined: June 15th, 2018, 2:10 pm

Re: Time- based Wallpaper Changer: Change Hour

JohnSmithESP » September 11th, 2018, 8:55 pm

Obviusly is no number
IfCondition=(MeasureConvertNum >= 21) && (MeasureConvertNum < 06)
>21 and <6 is imposible

Code: Select all

[MeasureConvertNum]
Measure=Calc
Formula=MeasureTime
IfCondition=(MeasureConvertNum < 06)
IfTrueAction=!Execute [!SetWallpaper "#@#TimeOfDayWall/Night.jpg"]
IfCondition2=(MeasureConvertNum >= 06) && (MeasureConvertNum < 12)
IfTrueAction2=!Execute [!SetWallpaper "#@#TimeOfDayWall/Morning.jpg"]
IfCondition3=(MeasureConvertNum >= 12) && (MeasureConvertNum < 18)
IfTrueAction3=!Execute [!SetWallpaper "#@#TimeOfDayWall/Afternoon.jpg"]
IfCondition4=(MeasureConvertNum >= 18) && (MeasureConvertNum < 21)
IfTrueAction4=!Execute [!SetWallpaper "#@#TimeOfDayWall/Evening.jpg"]
IfCondition5=(MeasureConvertNum >= 21)
IfTrueAction5=!Execute [!SetWallpaper "#@#TimeOfDayWall/Night.jpg"]
Perseverance is the key... and maths too
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3025
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Time- based Wallpaper Changer: Change Hour

eclectic-tech » September 12th, 2018, 2:39 am

You answered your own question, but I would offer a slightly simpler set of conditions using the 'OR' conditional operator || (see IfCondition4 below). :)

Code: Select all

[MeasureConvertNum]
Measure=Calc
Formula=MeasureTime
IfCondition=(MeasureConvertNum >= 06) && (MeasureConvertNum < 12)
IfTrueAction=[!SetWallpaper "#@#TimeOfDayWall/Morning.jpg"]
IfCondition2=(MeasureConvertNum >= 12) && (MeasureConvertNum < 18)
IfTrueAction2=[!SetWallpaper "#@#TimeOfDayWall/Afternoon.jpg"]
IfCondition3=(MeasureConvertNum >= 18) && (MeasureConvertNum < 21)
IfTrueAction3=[!SetWallpaper "#@#TimeOfDayWall/Evening.jpg"]
IfCondition4=(MeasureConvertNum >= 21) || (MeasureConvertNum < 6)
IfTrueAction4=[!SetWallpaper "#@#TimeOfDayWall/Night.jpg"]
The last condition tests if it is above 21 or below 6, and sets the night wallpaper accordingly.

Note: !Execute is not needed (deprecated) so all of those can be eliminated to also simplify the code. :welcome:
JohnSmithESP
Posts: 7
Joined: June 15th, 2018, 2:10 pm

Re: Time- based Wallpaper Changer: Change Hour

JohnSmithESP » September 12th, 2018, 2:29 pm

Oh, thanks. :17good
User avatar
balala
Rainmeter Sage
Posts: 7014
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Time- based Wallpaper Changer: Change Hour

balala » September 12th, 2018, 3:27 pm

In addition I'd add just that the [MeasureConvertNum] measure isn't needed at all, I think. The IfConditions can be added directly to the [MeasureTime] measure and this way you can avoid a further measure.
JohnSmithESP
Posts: 7
Joined: June 15th, 2018, 2:10 pm

Re: Time- based Wallpaper Changer: Change Hour

JohnSmithESP » September 13th, 2018, 2:11 pm

One more question:
I want to add around 10 different wallpapers and i want to know: if I change the Update value to 100000, it will load correctly but consuming less resource from the pc, right?
And, in terms of performance, would be better one skin with a high Update value or different skins with Update-1 and refresh it or reload with windows task scheduler?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3025
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Time- based Wallpaper Changer: Change Hour

eclectic-tech » September 15th, 2018, 12:50 am

JohnSmithESP wrote:One more question:
I want to add around 10 different wallpapers and i want to know: if I change the Update value to 100000, it will load correctly but consuming less resource from the pc, right?
And, in terms of performance, would be better one skin with a high Update value or different skins with Update-1 and refresh it or reload with windows task scheduler?
You could set the skin update rate to any value up to 3600000 (1 hour in milliseconds), but I don't believe this will make much difference in saving resources; the skin checks the value of the hour on each update and only acts when one of the conditions is met, so the impact on system resources is minimal.

This code will check once an hour and change the wallpaper if the condition is met. It uses the Time measure directly as balala suggested.

You can add more conditions and times if you want 10 different wallpapers (or add a measure to select a random wallpaper).

Code: Select all

[Rainmeter]
Update=3600000
Author=Connect-R

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

[MeasureTime]
Measure=Time
Format=%H
IfCondition=(#CurrentSection# >= 06) && (#CurrentSection# < 12)
IfTrueAction=[!SetWallpaper "#@#TimeOfDayWall/Morning.jpg"][!Log "Morning Wallpaper Set"]
IfCondition2=(#CurrentSection# >= 12) && (#CurrentSection# < 18)
IfTrueAction2=[!SetWallpaper "#@#TimeOfDayWall/Afternoon.jpg"][!Log "Afternoon Wallpaper Set"]
IfCondition3=(#CurrentSection# >= 18) && (#CurrentSection# < 21)
IfTrueAction3=[!SetWallpaper "#@#TimeOfDayWall/Evening.jpg"][!Log "Evening Wallpaper Set"]
IfCondition4=(#CurrentSection# >= 21) || (#CurrentSection# < 6)
IfTrueAction4=[!SetWallpaper "#@#TimeOfDayWall/Night.jpg"][!Log "Night Wallpaper Set"]

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

[MeterDummy]
Meter=String
UpdateDivider-1
User avatar
balala
Rainmeter Sage
Posts: 7014
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Time- based Wallpaper Changer: Change Hour

balala » September 15th, 2018, 6:48 am

The disadvantage of eclectic-tech's above code is that it doesn't change immediately the wallpaper when the hour changes. It takes up to one hour to change it. Taking into account what eclectic-tech said:
eclectic-tech wrote:but I don't believe this will make much difference in saving resources; the skin checks the value of the hour on each update and only acts when one of the conditions is met, so the impact on system resources is minimal.
I'd say that probably the best approach would be to use the default Update=1000. Probably won't affect too much the resources, but will change the wallpaper immediately when the hour changes.
JohnSmithESP
Posts: 7
Joined: June 15th, 2018, 2:10 pm

Re: Time- based Wallpaper Changer: Change Hour

JohnSmithESP » September 15th, 2018, 8:58 am

Ok thanks to both