I meant the Status Text. The one I'm switching from Online > Offline > Closed depending on the Day of the week and Time of they day. I need it to also consider the stat holiday and show Emergency Only.
It is currently April 18th, 2024, 10:57 am
Weekdays and Time based Text change.
-
- Posts: 11
- Joined: November 16th, 2022, 4:39 pm
Re: Weekdays and Time based Text change.
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Weekdays and Time based Text change.
Ok, now understood this. But there still is a question, namely how you want to keep track of the holidays? I mean that when it's a holiday, how the skin will know this? To let it know, you have to add the date of the holiday as a variable. Or there is another approach?foreverNoob wrote: ↑November 17th, 2022, 7:11 pm I meant the Status Text. The one I'm switching from Online > Offline > Closed depending on the Day of the week and Time of they day. I need it to also consider the stat holiday and show Emergency Only.
For instance, on December 25th, the Christmas day, how we'll tell the skin this is a holiday? Having a variable, like Holiday=12/26 or whatever might be a solution, but this is exactly what I should know, how would you like to treat those holidays?
-
- Posts: 11
- Joined: November 16th, 2022, 4:39 pm
Re: Weekdays and Time based Text change.
I was asking about the same question to you lol. If variable works that I'm okay with that but then it means we have too many && operators in IfCondition. Can we make the skin iterate through a file where all holidays are listed with the status to show when the date matches? Please feel free to mention better option.balala wrote: ↑November 17th, 2022, 7:48 pm Ok, now understood this. But there still is a question, namely how you want to keep track of the holidays? I mean that when it's a holiday, how the skin will know this? To let it know, you have to add the date of the holiday as a variable. Or there is another approach?
For instance, on December 25th, the Christmas day, how we'll tell the skin this is a holiday? Having a variable, like Holiday=12/26 or whatever might be a solution, but this is exactly what I should know, how would you like to treat those holidays?
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Weekdays and Time based Text change.
I don't say this is impossible, I rarely say something like this, but definitely is not easy. This is something which can easily be done in a real programming language, but in Rainmeter is a little bit more difficult. So, adding manually those variables is much easier. How many holidays do you want to use? There are 24 on the posted link. Manually adding 24 holidays can work.foreverNoob wrote: ↑November 17th, 2022, 7:55 pm Can we make the skin iterate through a file where all holidays are listed with the status to show when the date matches?
-
- Posts: 11
- Joined: November 16th, 2022, 4:39 pm
Re: Weekdays and Time based Text change.
You're correct, things would have been a lot more dynamic with an actual programming language. Perhaps Powershell support would be great! Anyway, If manually adding variables can make it work then, I'm happy with it for now. Let's go with all the holidays and once I understand how the conditions will works out I can modify it myself to change the amount of holidays.balala wrote: ↑November 17th, 2022, 8:24 pm I don't say this is impossible, I rarely say something like this, but definitely is not easy. This is something which can easily be done in a real programming language, but in Rainmeter is a little bit more difficult. So, adding manually those variables is much easier. How many holidays do you want to use? There are 24 on the posted link. Manually adding 24 holidays can work.
Are you able to give me an example I can start with?
Your help is much appreciated.
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Weekdays and Time based Text change.
Just saw: I completely messed up the IfCondition4, duplicating the option name. This has to be removed, obviously: IfCondition4=IfCondition4=((Measure24Hr >= 17) || (Measure24Hr < 8) || (MeasureDayOfWeek >= 6)) should be IfCondition4=((Measure24Hr >= 17) || (Measure24Hr < 8) || (MeasureDayOfWeek >= 6)) in order all conditions to work.balala wrote: ↑November 16th, 2022, 8:06 pmCode: Select all
[Measure24Hr] Measure=Time Format=%#H IfCondition=((Measure24Hr >= 8) && (Measure24Hr < 12) && (MeasureDayOfWeek < 6)) IfTrueAction=[!SetOption MeterSupportStatus Text "Online!"][!SetVariable statusColor "0,255,0,255"][!UpdateMeter MeterSupportStatus] IfCondition2=((Measure24Hr >= 12) && (Measure24Hr < 13) && (MeasureDayOfWeek < 6)) IfTrueAction2=[!SetOption MeterSupportStatus Text "Offline!"][!SetVariable statusColor "255,0,0,255"][!UpdateMeter MeterSupportStatus] IfCondition3=((Measure24Hr >= 13) && (Measure24Hr < 17) && (MeasureDayOfWeek < 6)) IfTrueAction3=[!SetOption MeterSupportStatus Text "Online!"][!SetVariable statusColor "0,255,0,255"][!UpdateMeter MeterSupportStatus] IfCondition4=IfCondition4=((Measure24Hr >= 17) || (Measure24Hr < 8) || (MeasureDayOfWeek >= 6)) IfTrueAction4=[!SetOption MeterSupportStatus Text "Closed!"][!SetVariable statusColor "255,0,0,255"][!UpdateMeter MeterSupportStatus]
Sorry, my bad I made this stupid mistake!!!
Here is it:foreverNoob wrote: ↑November 17th, 2022, 8:39 pm Are you able to give me an example I can start with?
- In order to keep track of those holidays, we need some variables storing the dates of holidays, for instance this way:
The last variable, Holiday (with no number) is a variable we'll need a little bit later, add it as well. As I suppose it's quite obvious, I added here only three holidays, but you can add further such variables if needed, so many as many are needed.
Code: Select all
[Variables] Holiday1=10.31 Holiday2=11.11 Holiday3=12.25 Holiday=0
- We need a measure which returns the date in the same format as the above variables. This measure will check if the current date coincides with any of the stored holiday dates, returning a variable accordingly. Add the following measure to your code:
If you're using more than three variables storing holiday dates, you obviously have to add further (#CURRENTSECTION#=#HolidayXX#) conditions to the IfCondition option, so many conditions as many holidays have you stored into the [Variables] section). I hope you got the idea how to do this (let me know if you didn't).
Code: Select all
[MeasureHoliday] Measure=Time Format=%m.%d IfCondition=((#CURRENTSECTION#=#Holiday1#)||(#CURRENTSECTION#=#Holiday2#)||(#CURRENTSECTION#=#Holiday3#)) IfTrueAction=[!SetVariable Holiday "1"][!UpdateMeasure "Measure24Hr"] IfFalseAction=[!SetVariable Holiday "0"][!UpdateMeasure "Measure24Hr"]
- Finally modify the IfConditions of the [Measure24Hr] measure, to get into account the value of the newly added Holiday variable as well. Replace the existing measure with the following one:
When replacing the measure take care NOT TO FORGET the DynamicVariables=1 option, which has not been present previously, because the measure won't work without it.
Code: Select all
[Measure24Hr] Measure=Time Format=%#H IfCondition=(#Holiday#=1) IfTrueAction=[!SetOption MeterSupportStatus Text "Emergency Only"][!SetVariable statusColor "255,0,0,255"][!UpdateMeter MeterSupportStatus][!Redraw] IfCondition=((Measure24Hr >= 8) && (Measure24Hr < 12) && (MeasureDayOfWeek < 6) && (#Holiday#=0)) IfTrueAction=[!SetOption MeterSupportStatus Text "Online!"][!SetVariable statusColor "0,255,0,255"][!UpdateMeter MeterSupportStatus][!Redraw] IfCondition2=((Measure24Hr >= 12) && (Measure24Hr < 13) && (MeasureDayOfWeek < 6) && (#Holiday#=0)) IfTrueAction2=[!SetOption MeterSupportStatus Text "Offline!"][!SetVariable statusColor "255,0,0,255"][!UpdateMeter MeterSupportStatus][!Redraw] IfCondition3=((Measure24Hr >= 13) && (Measure24Hr < 17) && (MeasureDayOfWeek < 6) && (#Holiday#=0)) IfTrueAction3=[!SetOption MeterSupportStatus Text "Online!"][!SetVariable statusColor "0,255,0,255"][!UpdateMeter MeterSupportStatus][!Redraw] IfCondition4=(((Measure24Hr >= 17) || (Measure24Hr < 8) || (MeasureDayOfWeek >= 6)) && (#Holiday#=0)) IfTrueAction4=[!SetOption MeterSupportStatus Text "Closed!"][!SetVariable statusColor "255,0,0,255"][!UpdateMeter MeterSupportStatus][!Redraw] DynamicVariables=1
Please try out the above solution and let me know if you could get it to work.
-
- Posts: 11
- Joined: November 16th, 2022, 4:39 pm
Re: Weekdays and Time based Text change.
You're brilliant Sir!
I'll report back with the update once I finish this.
I'll report back with the update once I finish this.
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Weekdays and Time based Text change.
I am not at all. Many people say I am not.
Please do so. Am curious...foreverNoob wrote: ↑November 19th, 2022, 2:37 am I'll report back with the update once I finish this.
-
- Posts: 11
- Joined: November 16th, 2022, 4:39 pm
Re: Weekdays and Time based Text change.
I noticed the first two IfConditions have no number to make them unique. Wouldn't that ignore the 2nd one? or is that something the DynamicVariable=1 will take care of? I added couple more holidays and it seems to be working fine.
-
- Rainmeter Sage
- Posts: 16143
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Weekdays and Time based Text change.
Right. My bad. Again.foreverNoob wrote: ↑November 20th, 2022, 8:36 pm I noticed the first two IfConditions have no number to make them unique. Wouldn't that ignore the 2nd one?
Obviously, you have to number the IfConditions (and the appropriate IfTrueActions) in order. So, replace the second occurence of IfCondition and IfTrueAction with IfCondition2 and IfTrueAction2, the old IfCondition2 and IfTrueAction2 with IfCondition3 and IfTrueAction3 and so on.
Sorry for this extremely stupid mistake. A copy / paste problem.
The DynamicVariables=1 option is needed because the measure uses a variable (#Holiday#), which is dynamically set with !SetVariable bangs into the IfTrueAction and IfFalseAction options of the [MeasureHoliday] measure. Doesn't matter what you do, Rainmeter ALWAYS ignores the second occurrence of options, sections, variables.foreverNoob wrote: ↑November 20th, 2022, 8:36 pm or is that something the DynamicVariable=1 will take care of?
Yep, but this only because you didn't try the code from Monday to Friday, between 8AM and 12PM, when there is no holiday set. These are the conditions set into the second not-numbered IfCondition, which is ignored by Rainmeter. But please re-number the options, as explained above.foreverNoob wrote: ↑November 20th, 2022, 8:36 pm I added couple more holidays and it seems to be working fine.
Sorry again for this mistake.