It is currently April 19th, 2024, 2:51 pm

MeasureHour +1

Get help with creating, editing & fixing problems with skins
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

MeasureHour +1

Post by xenium »

Hi
I have the code below that colors in yellow, current hour

Code: Select all

[Variables]

Color=0,0,0,1
Color2=255,208,0
Color3=255,128,0
Color4=255,0,0


[msHour]
Measure=Time
Format=%#I
OnUpdateAction=[!SetOptionGroup Hours LineColor #Color#][!SetOption mHour[msHour] LineColor #Color2#]


[mHour1]
Group=Hours
Meter=Roundline
.
.
LineColor=#Color#

[mHour2]
Group=Hours
Meter=Roundline
.
.
LineColor=#Color#

[mHour3]
Group=Hours
Meter=Roundline
.
.
LineColor=#Color#

.
.
.
I would like to add the color 3 for the first hour after the current hour and the color 4 for the second hour after the current hour.
I tried the variant below but it does not work:

Code: Select all

[msHour+1]
Measure=Time
Format=%#I
TimeStamp=([msHour:]+3600)
DynamicVariables=1

[msHour+2]
Measure=Time
Format=%#I
TimeStamp=([msHour:]+2*3600)
DynamicVariables=1


[msHour]
Measure=Time
Format=%#I
OnUpdateAction=[!SetOptionGroup Hours LineColor #Color#][!SetOption mHour[msHour] LineColor #Color2#][!SetOption mHour[msHour+1] LineColor #Color3#][!SetOption mHour[msHour+2] LineColor #Color4#]
What is wrong ?
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureHour +1

Post by balala »

Remove the Format=%#I option from the [msHour] measure.
Additionally, if you need the value returned by the [msHour] measure, you can add a new Time measure, which will have no Format option and be used only into the [msHour+1] and [msHour+2] measures:

Code: Select all

[msTime]
Measure=Time

[msHour+1]
Measure=Time
Format=%#I
TimeStamp=([msTime:]+3600)
DynamicVariables=1

[msHour+2]
Measure=Time
Format=%#I
TimeStamp=([msTime:]+2*3600)
DynamicVariables=1
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

Re: MeasureHour +1

Post by xenium »

balala wrote: December 26th, 2018, 2:33 pm Remove the Format=%#I option from the [msHour] measure.
Additionally, if you need the value returned by the [msHour] measure, you can add a new Time measure, which will have no Format option and be used only into the [msHour+1] and [msHour+2] measures:

Code: Select all

[msTime]
Measure=Time

[msHour+1]
Measure=Time
Format=%#I
TimeStamp=([msTime:]+3600)
DynamicVariables=1

[msHour+2]
Measure=Time
Format=%#I
TimeStamp=([msTime:]+2*3600)
DynamicVariables=1
If the Format=%#I option from the [msHour] measure is removed, the 2 extra hours appear colored, but the current hour is not colored.
If the option is not removed, the current hour is colored but not the other 2 hours.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureHour +1

Post by balala »

Please post the whole code.
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

Re: MeasureHour +1

Post by xenium »

balala wrote: December 26th, 2018, 3:15 pm Please post the whole code.
Clock.zip
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureHour +1

Post by balala »

xenium wrote: December 26th, 2018, 3:43 pmClock.zip
There is an issue with the [cHourXX] measures (where obviously XX varies from 1 to 12): these measures are returning 0, up to the corresponding hour, when they get their non-zero values. This is cause by the (msHour>=XX) inequalities, contained into their formula.
There would be two simple solutions (choose one of them, which you prefer):
  • Modify the Formula option of the [cHourXX] measure, decreasing the values which the value of the [msHour] measure is compared with, with 2. For example the Formula option of the [cHour3] measure should become Formula=#HourAngle#*(msHour>=1). This solution would convert the Formula option of [cHour2] measure into Formula=#HourAngle# (same as the Formula of [cHour1]), making the first two sections always visible.
  • Modify the code in a way to not set the color of [mHourXX] meters, but those of [HourXX] meters. For this you have to modify the two !SetOption bangs of the OnUpdateAction option of [msHour] measure. Instead of the existing [!SetOption mHour[msHour+1] LineColor #Color3#][!SetOption mHour[msHour+2] LineColor #Color4#] bangs, use them as [!SetOption Hour[msHour+1] LineColor "#Color3#"][!SetOption Hour[msHour+2] LineColor "#Color4#"]. Leave untouched the other bangs of this option. This solution colors the [HourXX] meters, instead of [mHourXX], but I think this isn't a problem.
User avatar
xenium
Posts: 865
Joined: January 4th, 2018, 9:52 pm

Re: MeasureHour +1

Post by xenium »

balala wrote: December 26th, 2018, 5:10 pm There is an issue with the [cHourXX] measures (where obviously XX varies from 1 to 12): these measures are returning 0, up to the corresponding hour, when they get their non-zero values. This is cause by the (msHour>=XX) inequalities, contained into their formula.
There would be two simple solutions (choose one of them, which you prefer):
  • Modify the Formula option of the [cHourXX] measure, decreasing the values which the value of the [msHour] measure is compared with, with 2. For example the Formula option of the [cHour3] measure should become Formula=#HourAngle#*(msHour>=1). This solution would convert the Formula option of [cHour2] measure into Formula=#HourAngle# (same as the Formula of [cHour1]), making the first two sections always visible.
  • Modify the code in a way to not set the color of [mHourXX] meters, but those of [HourXX] meters. For this you have to modify the two !SetOption bangs of the OnUpdateAction option of [msHour] measure. Instead of the existing [!SetOption mHour[msHour+1] LineColor #Color3#][!SetOption mHour[msHour+2] LineColor #Color4#] bangs, use them as [!SetOption Hour[msHour+1] LineColor "#Color3#"][!SetOption Hour[msHour+2] LineColor "#Color4#"]. Leave untouched the other bangs of this option. This solution colors the [HourXX] meters, instead of [mHourXX], but I think this isn't a problem.
Thanks a lot !
I will use the second solution, I see it works.
(Sarbatori fericite !)
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MeasureHour +1

Post by balala »

xenium wrote: December 26th, 2018, 6:27 pm Thanks a lot !
I will use the second solution, I see it works.
(Sarbatori fericite !)
I think both work. However as I said, you can choose any of them.
(Mulțumesc, la fel își doresc și ție)