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).
It is currently December 1st, 2023, 6:47 am
Rainmeter wallpaper problems
-
- Rainmeter Sage
- Posts: 15814
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Rainmeter wallpaper problems
-
- Posts: 17
- Joined: July 30th, 2019, 2:43 pm
Re: Rainmeter wallpaper problems
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?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
If not, could you explain to me how 180000 is 6a.m. in this case?
-
- Developer
- Posts: 22593
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Rainmeter wallpaper problems
180000 would not be 6am, but rather 6pm. To get exactly 6am, it would be something like: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?
Code: Select all
[MeasureTime]
Measure=Time
Format=%H%M%S
IfCondition=MeasureTime=060000
IfTrueAction=[!Log "true"]
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"]
You could be a bit more specific, with:
Code: Select all
[MeasureTime]
Measure=Time
Format=%H%M
IfCondition=MeasureTime=0600
IfTrueAction=[!Log "true"]
-
- Rainmeter Sage
- Posts: 15814
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Rainmeter wallpaper problems
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 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?
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
I thought you're thinking to 6PM, not to 6AM. Have I misunderstood something? Sorry if I have.
-
- Posts: 17
- Joined: July 30th, 2019, 2:43 pm
Re: Rainmeter wallpaper problems
Thanks for the insight jsmorley.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:
So you are saying: "When the hour is 06 and the minutes are 00 and the seconds are 00"Code: Select all
[MeasureTime] Measure=Time Format=%H%M%S IfCondition=MeasureTime=060000 IfTrueAction=[!Log "true"]
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:
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.Code: Select all
[MeasureTime] Measure=Time Format=%H IfCondition=MeasureTime=06 IfTrueAction=[!Log "true"]
You could be a bit more specific, with:
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.Code: Select all
[MeasureTime] Measure=Time Format=%H%M IfCondition=MeasureTime=0600 IfTrueAction=[!Log "true"]
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"]
-
- Developer
- Posts: 22593
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Rainmeter wallpaper problems
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.
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.
Be sure you actually used the Layouts panel in the Manage dialog to create saved layouts with the names you are looking for.
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.
-
- Developer
- Posts: 22593
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Rainmeter wallpaper problems
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"]
-
- Rainmeter Sage
- Posts: 5230
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Rainmeter wallpaper problems
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.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"]
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"]
BTW, thanks for your corrections to my time measure formatting, sometimes I skip actually testing before posting code, my bad.

:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Developer
- Posts: 22593
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Rainmeter wallpaper problems
That's a good idea eclectic-tech!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.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.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"]
BTW, thanks for your corrections to my time measure formatting, sometimes I skip actually testing before posting code, my bad.![]()
-
- Posts: 17
- Joined: July 30th, 2019, 2:43 pm
Re: Rainmeter wallpaper problems
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?
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]"]