It is currently March 28th, 2024, 11:02 pm

How to isolate each clock digits

Get help with creating, editing & fixing problems with skins
User avatar
Rambytes
Posts: 27
Joined: August 30th, 2017, 10:36 pm

How to isolate each clock digits

Post by Rambytes »

Hi, I will try to do my best because english is not my language.

I need to isolate each digit of the current time to be displayed in my skin at specific X-Y location.

Example: if the time is 12:37:54, I need to diplay only the number 5 at X=100 and the number 4 at X=120, etc..... Same thing for the minute and again for the hour.

This is possible???

Thanks alot :)
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to isolate each clock digits

Post by balala »

Rambytes wrote:I need to isolate each digit of the current time to be displayed in my skin at specific X-Y location.

Example: if the time is 12:37:54, I need to diplay only the number 5 at X=100 and the number 4 at X=120, etc..... Same thing for the minute and again for the hour.

This is possible???

Thanks alot :)
It definitely is. You probably have there a Time measure, which returns the time. Something like:

Code: Select all

[MeasureTime]
Measure=Time
Format=%H:%M:%S
You have to create so many String measures as many digits you have, six in this case:

Code: Select all

[MeasureDigitH1]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.)(.):(.)(.):(.)(.)$":"\1"
DynamicVariables=1

[MeasureDigitH2]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.)(.):(.)(.):(.)(.)$":"\2"
DynamicVariables=1

[MeasureDigitM1]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.)(.):(.)(.):(.)(.)$":"\3"
DynamicVariables=1

[MeasureDigitM2]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.)(.):(.)(.):(.)(.)$":"\4"
DynamicVariables=1

[MeasureDigitS1]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.)(.):(.)(.):(.)(.)$":"\5"
DynamicVariables=1

[MeasureDigitS2]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.)(.):(.)(.):(.)(.)$":"\6"
DynamicVariables=1
Each of these measures will return the appropriate digit, eg [MeasureDigitH1] returns the first digit of the hours, [MeasureDigitH2] the second digit of the hours and so on. Then use these measures into the String meters.
User avatar
Rambytes
Posts: 27
Joined: August 30th, 2017, 10:36 pm

Re: How to isolate each clock digits

Post by Rambytes »

Wow... thanks alot for the quick response... I will try right now.
User avatar
Rambytes
Posts: 27
Joined: August 30th, 2017, 10:36 pm

Re: How to isolate each clock digits

Post by Rambytes »

The hour is not working, maybe is because my time format is this:

Code: Select all

[MeasureTime]
Measure=Time
Format=%#I:%M:%S
My format is a 12h time display and no "zero" for the hour
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to isolate each clock digits

Post by balala »

Rambytes wrote:My format is a 12h time display and no "zero" for the hour
Yep, that's why it's not working. Replace the Substitute option on the previously posted String measures, as it follows (leave untouched the other options):

Code: Select all

[MeasureDigitH1]
...
Substitute="^(.):(.)(.):(.)(.)$":"0","^(.)(.):(.)(.):(.)(.)$":"\1"

[MeasureDigitH2]
...
Substitute="^(.):(.)(.):(.)(.)$":"\1","^(.)(.):(.)(.):(.)(.)$":"\2"

[MeasureDigitM1]
...
Substitute="^(.):(.)(.):(.)(.)$":"\2","^(.)(.):(.)(.):(.)(.)$":"\3"

[MeasureDigitM2]
...
Substitute="^(.):(.)(.):(.)(.)$":"\3","^(.)(.):(.)(.):(.)(.)$":"\4"

[MeasureDigitS1]
...
Substitute="^(.):(.)(.):(.)(.)$":"\4","^(.)(.):(.)(.):(.)(.)$":"\5"

[MeasureDigitS2]
...
Substitute="^(.):(.)(.):(.)(.)$":"\5","^(.)(.):(.)(.):(.)(.)$":"\6"
Here I used different substitutions when the hour has one respectively two digits.
User avatar
Rambytes
Posts: 27
Joined: August 30th, 2017, 10:36 pm

Re: How to isolate each clock digits

Post by Rambytes »

mmmm.... the hour still display two digits..... Right now here in Montreal is 4:29:00. But the display is 04:29:00. With this new code, the zero BEFORE the 04 is still there.
User avatar
Rambytes
Posts: 27
Joined: August 30th, 2017, 10:36 pm

Re: How to isolate each clock digits

Post by Rambytes »

This is my full code

Code: Select all

[Rainmeter]

[Variables]
StartX=60
Gap=100

[MeasureTime]
Measure=Time
Format=%#I:%M:%S

[TextStyle]
FontFace=Jersey Sharp
FontColor=255,255,255
FontSize=100
AntiAlias=1
StringStyle=Bold

[MeasureDigitH1]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.):(.)(.):(.)(.)$":"0","^(.)(.):(.)(.):(.)(.)$":"\1"
DynamicVariables=1

[MeasureDigitH2]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.):(.)(.):(.)(.)$":"\1","^(.)(.):(.)(.):(.)(.)$":"\2"
DynamicVariables=1

[MeasureDigitM1]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.):(.)(.):(.)(.)$":"\2","^(.)(.):(.)(.):(.)(.)$":"\3"
DynamicVariables=1

[MeasureDigitM2]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.):(.)(.):(.)(.)$":"\3","^(.)(.):(.)(.):(.)(.)$":"\4"
DynamicVariables=1

[MeasureDigitS1]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.):(.)(.):(.)(.)$":"\4","^(.)(.):(.)(.):(.)(.)$":"\5"
DynamicVariables=1

[MeasureDigitS2]
Measure=String
String=[MeasureTime]
RegExpSubstitute=1
Substitute="^(.):(.)(.):(.)(.)$":"\5","^(.)(.):(.)(.):(.)(.)$":"\6"
DynamicVariables=1

[LesHeures_1]
X=#StartX#
Y=0
Meter=String
MeterStyle=TextStyle
MeasureName=MeasureDigitH1
StringAlign=CENTER

[LesHeures_2]
X=#Gap#r
Y=0
Meter=String
MeterStyle=TextStyle
MeasureName=MeasureDigitH2
StringAlign=CENTER

[LesMinutes_1]
X=((#Gap#)+(#Gap#/2))r
Y=0
Meter=String
MeterStyle=TextStyle
MeasureName=MeasureDigitM1
StringAlign=CENTER

[LesMinutes_2]
X=#Gap#r
Y=0
Meter=String
MeterStyle=TextStyle
MeasureName=MeasureDigitM2
StringAlign=CENTER

[LesSecondes_1]
X=((#Gap#)+(#Gap#/2))r
Y=0
Meter=String
MeterStyle=TextStyle
MeasureName=MeasureDigitS1
StringAlign=CENTER

[LesSecondes_2]
X=#Gap#r
Y=0
Meter=String
MeterStyle=TextStyle
MeasureName=MeasureDigitS2
StringAlign=CENTER

[OnReset]
X=0

[LesDeuxPoints_1]
X=((#Gap#*2)+(#Gap#/2)-15)
Y=-15
Meter=String
MeterStyle=TextStyle
StringAlign=CENTER
Text=":"

[LesDeuxPoints_2]
X=((#Gap#*2)+(#Gap#/2)+0)r
Y=-15
Meter=String
MeterStyle=TextStyle
StringAlign=CENTER
Text=":"

User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to isolate each clock digits

Post by balala »

Rambytes wrote:mmmm.... the hour still display two digits..... Right now here in Montreal is 4:29:00. But the display is 04:29:00. With this new code, the zero BEFORE the 04 is still there.
Yeah, because if the hour has one single digit, the first digit of the hours is set to 0. Just take a look at the Substitute option of the [MeasureDigitH1]. It is Substitute="^[color=#FF0000](.)[/color]:(.)(.):(.)(.)$":"[color=#0000FF]0[/color]","^(.)(.):(.)(.):(.)(.)$":"\1", which means that if the hours has one digit (red above), it is substituted with a 0 (blue above).
If you'd like nothing to be shown in such cases, just remove the blue zero, from the previous Substitute option: Substitute="^(.):(.)(.):(.)(.)$":"","^(.)(.):(.)(.):(.)(.)$":"\1"
User avatar
Rambytes
Posts: 27
Joined: August 30th, 2017, 10:36 pm

Re: How to isolate each clock digits

Post by Rambytes »

Thanks you very much for the help..... very appreciated, but very very!!!!!

Thanks and kudos!!!
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to isolate each clock digits

Post by balala »

Glad to help.