It is currently April 20th, 2024, 3:06 pm

Changing wallpaper with time

Get help with creating, editing & fixing problems with skins
zaxnite
Posts: 13
Joined: November 1st, 2020, 4:37 pm

Changing wallpaper with time

Post by zaxnite »

When I am trying ti change the wallpaper for 3 times of the day Day.Evening and night it only works for the first 2 and the 3 one doesnt work hers the code i used and all the images are in the same file

Code: Select all

[Metadata]
Name=BG Changer Time
Author=Thiena
Information=
Version=1.0
License=What's This

[Rainmeter]
Update=100
Group=NONE

[MeasureTime]
Measure=Time
Format=%H%M

[MeasureEqual]
Measure=Calc
IfCondition=(MeasureTime > 0600 ) && (MeasureTime < 1430 )
IfTrueAction=!SetWallpaper "1.jpg"
IffCondition2=(MeasureTime > 1430 ) && (MeasureTime < 1959)
IfTrueAction2=!SetWallpaper "2.jpg"
IfCondition3=(MeasureTime > 2000 ) && (MeasureTime < 0600)
IfTrueAction3=!SetWallpaper "3.jpg"

[MeterTestImage]
Meter=Image
Imagename=""
Last edited by zaxnite on November 1st, 2020, 4:46 pm, edited 2 times in total.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing wallpaper with time

Post by jsmorley »

You sure you want 20000 in that last one and not 2000?
zaxnite
Posts: 13
Joined: November 1st, 2020, 4:37 pm

Re: Changing wallpaper with time

Post by zaxnite »

ops crap that's embarrassing
zaxnite
Posts: 13
Joined: November 1st, 2020, 4:37 pm

Re: Changing wallpaper with time

Post by zaxnite »

its still not working
it only shows first image
User avatar
balala
Rainmeter Sage
Posts: 16150
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing wallpaper with time

Post by balala »

zaxnite wrote: November 1st, 2020, 4:45 pm its still not working
it only shows first image
The second IfCondition of the [MeasureEqual] measure is written mistakenly. It has an extra f: IffCondition2=(MeasureTime > 1430 ) && (MeasureTime < 1959). Remove it.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing wallpaper with time

Post by jsmorley »

zaxnite wrote: November 1st, 2020, 4:45 pm its still not working
it only shows first image
The problem is with:

IffCondition2

Edit: Balala beat me to it...

If there is no valid IfCondition2, then IfCondition3 is never even evaluated. There must be sequential IfConditions.
zaxnite
Posts: 13
Joined: November 1st, 2020, 4:37 pm

Re: Changing wallpaper with time

Post by zaxnite »

The code:

Code: Select all

[Metadata]
Name=BG Changer Time
Author=Thiena
Information=
Version=1.0
License=What's This

[Rainmeter]
Update=100
Group=NONE

[MeasureTime]
Measure=Time
Format=%H%M

[MeasureEqual]
Measure=Calc
IfCondition=(MeasureTime > 0600 ) && (MeasureTime < 1430 )
IfTrueAction=!SetWallpaper "1.jpg"
IfCondition2=(MeasureTime > 1430 ) && (MeasureTime < 1959)
IfTrueAction2=!SetWallpaper "2.jpg"
IfCondition3=(MeasureTime > 2000 ) && (MeasureTime < 0600)
IfTrueAction3=!SetWallpaper "3.jpg"

[MeterTestImage]
Meter=Image
Imagename=""
still shows only the first one
Last edited by balala on November 1st, 2020, 5:16 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are posting code snippets. It's the </> button.
zaxnite
Posts: 13
Joined: November 1st, 2020, 4:37 pm

Re: Changing wallpaper with time

Post by zaxnite »

I tried refreshing it several times unloading and loading

I am actually gonna cry

btw which language is this cuz I know python pretty well
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing wallpaper with time

Post by jsmorley »

zaxnite wrote: November 1st, 2020, 5:01 pm I tried refreshing it several times unloading and loading

I am actually gonna cry

btw which language is this cuz I know python pretty well
Well, I hate to state the obvious, but this is based on the current time. Unless you are changing the time settings on your PC, or are forcing a value into Format=%H%M like Format=1539 or something, I don't see how you would expect it to change.

Rainmeter is written in C++, and the skin .ini files are not in a particular "language" as such. They are written with code that is very specific to Rainmeter. https://docs.rainmeter.net/manual/getting-started/skin-anatomy/
zaxnite
Posts: 13
Joined: November 1st, 2020, 4:37 pm

Re: Changing wallpaper with time

Post by zaxnite »

So I did what you said again now the first 2 are changed but the third one isn't appearing is there like an elif statement i can use or like that \here is the code it switched btw 1 and 2 but when it reaches the time of the 3 it only shows the first

Code: Select all

[Metadata]
Name=BG Changer Time
Author=Thiena
Information=
Version=1.0
License=What's This

[Rainmeter]
Update=100
Group=NONE

[MeasureTime]
Measure=Time
Format=%H%M

[MeasureEqual]
Measure=Calc
IfCondition=(MeasureTime > 0600 ) && (MeasureTime < 1430 )
IfTrueAction=!SetWallpaper "1.jpg"
IfCondition2=(MeasureTime > 1430 ) && (MeasureTime < 1959)
IfTrueAction2=!SetWallpaper "2.jpg"
IfCondition3=(MeasureTime > 2000 ) && (MeasureTime < 0600)
IfTrueAction3=!SetWallpaper "3.jpg"

[MeterTestImage]
Meter=Image
Imagename=""
Last edited by balala on November 1st, 2020, 5:44 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are posting code snippets. It's the </> button.