It is currently March 29th, 2024, 1:11 am

Rainmeter wallpaper problems

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: Rainmeter wallpaper problems

Post by balala »

jsmorley wrote: August 1st, 2019, 12:03 pm While you could use the string value as a formula if you really want, I'm not sure I see a case where that makes sense, given the nature of clock arithmetic, which is modular in nature and not base-10.
Doesn't even has to be base-10. But every digit existing in the base 10 numbering system does exist when working with time, so in my opinion this is the easiest way to evaluate the value returned by a Time measure (to see if the value returned by the Time measure match the hour, minutes and seconds).
sockeater
Posts: 17
Joined: July 30th, 2019, 2:43 pm

Re: Rainmeter wallpaper problems

Post by sockeater »

balala wrote: August 1st, 2019, 6:12 am The [mTime] measure seems a little bit wrong, as it is written. Its Format option being set to Format=%H+%M+%S, it returns something like for instance 09+00+00. This isn't calculated and never will be equal to 600.
Probably the best would be to use the simpler Format=%H%M%S option and rewrite the IfCondition as it follows: IfCondition=mTime=180000
So I tried using the snippet of code where my layout is supposed to change based on time and it seems like it doesn't work as your post mentioned. Is there any way to make it so that I can format the code so that 600 = 6a.m. , 1300 = 1p.m. , 2300 = 11p.m. etc?
If not, could you explain to me how 180000 is 6a.m. in this case?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rainmeter wallpaper problems

Post by jsmorley »

sockeater wrote: August 1st, 2019, 3:04 pm So I tried using the snippet of code where my layout is supposed to change based on time and it seems like it doesn't work as your post mentioned. Is there any way to make it so that I can format the code so that 600 = 6a.m. , 1300 = 1p.m. , 2300 = 11p.m. etc?
If not, could you explain to me how 180000 is 6a.m. in this case?
180000 would not be 6am, but rather 6pm. To get exactly 6am, it would be something like:

Code: Select all

[MeasureTime]
Measure=Time
Format=%H%M%S
IfCondition=MeasureTime=060000
IfTrueAction=[!Log "true"]
So you are saying: "When the hour is 06 and the minutes are 00 and the seconds are 00"

Note that MeasureTime=60000 would also work, as leading zeros on the integer part of numbers are ignored.

I would caution that it is entirely possible for the Time measure in a skin to "skip" any given "second", depending on what else is going on in Rainmeter, and it is not 100% certain that this would be triggered at exactly 06:00:00. The Time measure might be evaluated by the skin at 05:59:59 and 06:00:01 for instance.

I'd be tempted to use something like:

IfCondition=(MeasureTime>=060000) && (MeasureTime<060005)

This will still only fire once, when the time is at or about 6am, give or take 4 seconds...


To be honest, I'm not sure all of this isn't overkill. If you just use:

Code: Select all

[MeasureTime]
Measure=Time
Format=%H
IfCondition=MeasureTime=06
IfTrueAction=[!Log "true"]
That is really enough. The IfTrueAction will only fire once, the first time the hour is at 6am. The only downside to this lack of specificity is that if you were to refresh the skin at say 6:27am, it would still fire once.

You could be a bit more specific, with:

Code: Select all

[MeasureTime]
Measure=Time
Format=%H%M
IfCondition=MeasureTime=0600
IfTrueAction=[!Log "true"]
Which means it would only fire once when the hour is at 6am, and would only fire on refresh during the first minute of the 6am hour.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rainmeter wallpaper problems

Post by balala »

sockeater wrote: August 1st, 2019, 3:04 pm So I tried using the snippet of code where my layout is supposed to change based on time and it seems like it doesn't work as your post mentioned. Is there any way to make it so that I can format the code so that 600 = 6a.m. , 1300 = 1p.m. , 2300 = 11p.m. etc?
What doesn't work? Read jsmorley's reply related to the possibility to skip the moment if you want to be extremely precise and want to check the seconds too. I'd use his last solution, with the Format=%H%M and IfCondition=MeasureTime=1800 options.
sockeater wrote: August 1st, 2019, 3:04 pm If not, could you explain to me how 180000 is 6a.m. in this case?
See jsmorley's reply above. 180000 isn't 6AM, but 6PM: 18 is the hour and 00, respectively the second pair of 00 are the minutes and the seconds.
My confusion was that when you wrote
sockeater wrote: July 30th, 2019, 10:03 pm Like say, if it turned 6 at night, it changes from afternoon theme to a dark theme.
I thought you're thinking to 6PM, not to 6AM. Have I misunderstood something? Sorry if I have.
sockeater
Posts: 17
Joined: July 30th, 2019, 2:43 pm

Re: Rainmeter wallpaper problems

Post by sockeater »

jsmorley wrote: August 1st, 2019, 3:08 pm 180000 would not be 6am, but rather 6pm. To get exactly 6am, it would be something like:

Code: Select all

[MeasureTime]
Measure=Time
Format=%H%M%S
IfCondition=MeasureTime=060000
IfTrueAction=[!Log "true"]
So you are saying: "When the hour is 06 and the minutes are 00 and the seconds are 00"

Note that MeasureTime=60000 would also work, as leading zeros on the integer part of numbers are ignored.

I would caution that it is entirely possible for the Time measure in a skin to "skip" any given "second", depending on what else is going on in Rainmeter, and it is not 100% certain that this would be triggered at exactly 06:00:00. The Time measure might be evaluated by the skin at 05:59:59 and 06:00:01 for instance.

I'd be tempted to use something like:

IfCondition=(MeasureTime>=060000) && (MeasureTime<060005)

This will still only fire once, when the time is at or about 6am, give or take 4 seconds...


To be honest, I'm not sure all of this isn't overkill. If you just use:

Code: Select all

[MeasureTime]
Measure=Time
Format=%H
IfCondition=MeasureTime=06
IfTrueAction=[!Log "true"]
That is really enough. The IfTrueAction will only fire once, the first time the hour is at 6am. The only downside to this lack of specificity is that if you were to refresh the skin at say 6:27am, it would still fire once.

You could be a bit more specific, with:

Code: Select all

[MeasureTime]
Measure=Time
Format=%H%M
IfCondition=MeasureTime=0600
IfTrueAction=[!Log "true"]
Which means it would only fire once when the hour is at 6am, and would only fire on refresh during the first minute of the 6am hour.
Thanks for the insight jsmorley.
So far this is what I have for my code

Code: Select all


[Metadata]
Name=N/a
Author=N/a
Information=Change Layout Based on Time
Version 0.01

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
Group=#RootConfig#

[measureTime]
Measure=Time
Format=%H%M%S
IfCondition=(measureTime>=090000) && (measureTime<090005)
IfTrueAction=[!LoadLayout "b1"]
IfCondition2=(measureTime>=103000) && (measureTime<103005)
IfTrueAction2=[!LoadLayout "b2"]
IfCondition3=(measureTime>=120000) && (measureTime<120005)
IfTrueAction3=[!LoadLayout "b3"]

When I tried this I haven't seen any changes on my layout, did I make a mistake somewhere? My layouts are named appropriately
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rainmeter wallpaper problems

Post by jsmorley »

Not sure. Works fine when I test it here.

Be sure you actually used the Layouts panel in the Manage dialog to create saved layouts with the names you are looking for.

1.jpg

And you are sure that each of the named layouts includes loading this skin that is testing the time and loading the layout?

P.S. You don't need and don't want duplicate [Rainmeter] sections, but that isn't fatal.
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rainmeter wallpaper problems

Post by jsmorley »

By the way, while I suggested a 5-second "grace period" for the test earlier, that wasn't with the idea that the true action itself would be causing a reload of the skin with the test. You are likely to get 3-4, maybe even 5 repeated loads of the same layout in very quick order with that. If you have a fast SSD drive and a powerful CPU, it might be able to load the same layout 5 times in 5 seconds... You might make it just be a 1-second grace period instead.

Code: Select all

[measureTime]
Measure=Time
Format=%H%M%S
IfCondition=(measureTime>=090000) && (measureTime<090001)
IfTrueAction=[!LoadLayout "b1"]
IfCondition2=(measureTime>=103000) && (measureTime<103001)
IfTrueAction2=[!LoadLayout "b2"]
IfCondition3=(measureTime>=120000) && (measureTime<120001)
IfTrueAction3=[!LoadLayout "b3"]
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Rainmeter wallpaper problems

Post by eclectic-tech »

jsmorley wrote: August 1st, 2019, 7:53 pm By the way, while I suggested a 5-second "grace period" for the test earlier, that wasn't with the idea that the true action itself would be causing a reload of the skin with the test. You are likely to get 3-4, maybe even 5 repeated loads of the same layout in very quick order with that. If you have a fast SSD drive and a powerful CPU, it might be able to load the same layout 5 times in 5 seconds... You might make it just be a 1-second grace period instead.

Code: Select all

[measureTime]
Measure=Time
Format=%H%M%S
IfCondition=(measureTime>=090000) && (measureTime<090001)
IfTrueAction=[!LoadLayout "b1"]
IfCondition2=(measureTime>=103000) && (measureTime<103001)
IfTrueAction2=[!LoadLayout "b2"]
IfCondition3=(measureTime>=120000) && (measureTime<120001)
IfTrueAction3=[!LoadLayout "b3"]
To eliminate multiple loading of layouts and still provide a 5 second time to test, add a delay bang to the actions that delays the layout load for 5 seconds once the condition is met.

Code: Select all

[measureTime]
Measure=Time
Format=%H%M%S
IfCondition=(measureTime>=090000) && (measureTime<090005)
IfTrueAction=[!Delay 5000][!LoadLayout "b1"]
IfCondition2=(measureTime>=103000) && (measureTime<103005)
IfTrueAction2=[!Delay 5000][!LoadLayout "b2"]
IfCondition3=(measureTime>=120000) && (measureTime<120005)
IfTrueAction3=[!Delay 5000][!LoadLayout "b3"]
This will prevent multiple loading of the layout by delaying the change for 5 seconds if the skin update in the [Rainmeter] section is 1000 ms.
BTW, thanks for your corrections to my time measure formatting, sometimes I skip actually testing before posting code, my bad. :great:
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rainmeter wallpaper problems

Post by jsmorley »

eclectic-tech wrote: August 1st, 2019, 10:59 pm To eliminate multiple loading of layouts and still provide a 5 second time to test, add a delay bang to the actions that delays the layout load for 5 seconds once the condition is met.

Code: Select all

[measureTime]
Measure=Time
Format=%H%M%S
IfCondition=(measureTime>=090000) && (measureTime<090005)
IfTrueAction=[!Delay 5000][!LoadLayout "b1"]
IfCondition2=(measureTime>=103000) && (measureTime<103005)
IfTrueAction2=[!Delay 5000][!LoadLayout "b2"]
IfCondition3=(measureTime>=120000) && (measureTime<120005)
IfTrueAction3=[!Delay 5000][!LoadLayout "b3"]
This will prevent multiple loading of the layout by delaying the change for 5 seconds if the skin update in the [Rainmeter] section is 1000 ms.
BTW, thanks for your corrections to my time measure formatting, sometimes I skip actually testing before posting code, my bad. :great:
That's a good idea eclectic-tech!
sockeater
Posts: 17
Joined: July 30th, 2019, 2:43 pm

Re: Rainmeter wallpaper problems

Post by sockeater »

Thank you jsmorley, eclectic-tech, and balala for helping me through my rainmeter problems!
I got the layout changer to finally start working and I think I'm going to make it so it opens a random layout(I want to incorporate random inspirational quotes and such with layouts).

From the code provided by eclectic-tech, is there a way to make it so that highbound matches with the number of layouts I currently have saved or is that not possible?

Code: Select all

[mRandom]
Measure=Calc
Formula=Random
LowBound=1
HighBound=3
DynamicVariables=1

[mTime]
Measure=Time
Format=%H%M%S
IfCondition=mTime=60000
IfTrueAction=[!LoadLayout "MyMorningLayout[%mRandom]"]