So, I'm creating a clock, and I want to set the time as a variable to use it in a way so that I can cut the string into individual numbers for example:
say the time is 10:15 01/01 so I'd like to separate it into individual characters like "1","0","1","5","0","1","0","1" like this so I can put them wherever I want with some symbols in between, is it possible?
It is currently May 30th, 2024, 1:06 pm
I'm creating a clock, and need help
-
- Posts: 9
- Joined: October 15th, 2021, 2:41 pm
-
- Rainmeter Sage
- Posts: 16282
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: I'm creating a clock, and need help
You probably should have to get each number (hour, minutes, seconds, day and so on) one by one, into different measures (not the whole time and date by one single measure). Then you can use substitutions, to get each digit. For instance:YRS1999 wrote: ↑January 4th, 2024, 2:30 pm So, I'm creating a clock, and I want to set the time as a variable to use it in a way so that I can cut the string into individual numbers for example:
say the time is 10:15 01/01 so I'd like to separate it into individual characters like "1","0","1","5","0","1","0","1" like this so I can put them wherever I want with some symbols in between, is it possible?
Code: Select all
[MeasureHourDigit1]
Measure=Time
Format=%H
RegExpSubstitute=1
Substitute="^(.).$":"\1"
[MeasureHourDigit2]
Measure=Time
Format=%H
RegExpSubstitute=1
Substitute="^.(.)$":"\1"
Depending on what would you like to achieve, maybe there is no need to complicate things this way (you have to use suplimentar measures above the ones needed). Maybe InlineSettings of String meters could do the job. So, what would you like to do? And maybe you could add the code you have so far.
-
- Posts: 9
- Joined: October 15th, 2021, 2:41 pm
Re: I'm creating a clock, and need help
Thanks, So after this I can just put it in Text = %1 , Text = %2 under meter to print those numbers correct? And I don't need to put the MeasureName?balala wrote: ↑January 4th, 2024, 3:47 pm You probably should have to get each number (hour, minutes, seconds, day and so on) one by one, into different measures (not the whole time and date by one single measure). Then you can use substitutions, to get each digit. For instance:With the above code, when the hour is 18 for example, [MeasureHourDigit1] returns 1 and [MeasureHourDigit2] returns 8.Code: Select all
[MeasureHourDigit1] Measure=Time Format=%H RegExpSubstitute=1 Substitute="^(.).$":"\1" [MeasureHourDigit2] Measure=Time Format=%H RegExpSubstitute=1 Substitute="^.(.)$":"\1"
Depending on what would you like to achieve, maybe there is no need to complicate things this way (you have to use suplimentar measures above the ones needed). Maybe InlineSettings of String meters could do the job. So, what would you like to do? And maybe you could add the code you have so far.
I'm trying to make a clock that displays time like this H.HMMddmm in a single string, also if I create multiple meters without adding x and y then will it overlap on each other?
-
- Posts: 9
- Joined: October 15th, 2021, 2:41 pm
Re: I'm creating a clock, and need help
Thanks, I was able to come up with the code that I'm satisfied with:balala wrote: ↑January 4th, 2024, 3:47 pm You probably should have to get each number (hour, minutes, seconds, day and so on) one by one, into different measures (not the whole time and date by one single measure). Then you can use substitutions, to get each digit. For instance:With the above code, when the hour is 18 for example, [MeasureHourDigit1] returns 1 and [MeasureHourDigit2] returns 8.Code: Select all
[MeasureHourDigit1] Measure=Time Format=%H RegExpSubstitute=1 Substitute="^(.).$":"\1" [MeasureHourDigit2] Measure=Time Format=%H RegExpSubstitute=1 Substitute="^.(.)$":"\1"
Depending on what would you like to achieve, maybe there is no need to complicate things this way (you have to use suplimentar measures above the ones needed). Maybe InlineSettings of String meters could do the job. So, what would you like to do? And maybe you could add the code you have so far.
Code: Select all
[Rainmeter]
Update1000
[MeasureTime1]
Measure=Time
Format=%H%M%d%m
RegExpSubstitute=1
Substitute="^(.).......$":"\1"
[MeasureTime2]
Measure=Time
Format=%H%M%d%m
RegExpSubstitute=1
Substitute="^.(.......)$":"\1"
[MeterTime]
Meter= String
MeasureName= MeasureTime1
MeasureName2= MeasureTime2
Text = %1.%2
FontSize = 18
Also I've font file I like to use in this skin only so do I need to add @Resource folder and place font in it, and do fontface = #@Resource#/filename?
-
- Rainmeter Sage
- Posts: 16282
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: I'm creating a clock, and need help
For this you have to create just one single Time measure. Like this one:YRS1999 wrote: ↑January 4th, 2024, 4:31 pm Thanks, So after this I can just put it in Text = %1 , Text = %2 under meter to print those numbers correct? And I don't need to put the MeasureName?
I'm trying to make a clock that displays time like this H.HMMddmm in a single string, also if I create multiple meters without adding x and y then will it overlap on each other?
Code: Select all
[MeasureTime]
Measure=Time
Format=%H%M%d%m
Code: Select all
[MeasureTime]
Measure=Time
Format=%H%M%d%m
RegExpSubstitute=1
Substitute="^(.)(.*)$":"\1.\2"
With this approach, the [MeterTime] meter should have one single MeasureName option:
Code: Select all
[MeterTime]
Meter= String
MeasureName= MeasureTime
Text = %1
FontSize = 18
You have to use more String meters, each with its own settings. They can have different sizes, font types, colors and so on. You have to position them properly to achieve the desired look.
Create the @Resources folder (if you don't already have it). Create a Fonts folder in this @Resources folder. Add the .ttf or .otf files of the fonts into this Fonts folder. If you did this, you can use them like they were installed on your computer. You can use them by FontFace=... options on String meters. See details here.
-
- Posts: 9
- Joined: October 15th, 2021, 2:41 pm
Re: I'm creating a clock, and need help
Thanks, man!balala wrote: ↑January 4th, 2024, 5:21 pm For this you have to create just one single Time measure. Like this one:If you want to put a dot between the two digits of the hour, add the following two options to the above measure:Code: Select all
[MeasureTime] Measure=Time Format=%H%M%d%m
Not sure what this is good for, but can be done.Code: Select all
[MeasureTime] Measure=Time Format=%H%M%d%m RegExpSubstitute=1 Substitute="^(.)(.*)$":"\1.\2"
With this approach, the [MeterTime] meter should have one single MeasureName option:The dot is added by the Substitute option of the [MeasureTime] measure, no need to add it into the String meter.Code: Select all
[MeterTime] Meter= String MeasureName= MeasureTime Text = %1 FontSize = 18
You have to use more String meters, each with its own settings. They can have different sizes, font types, colors and so on. You have to position them properly to achieve the desired look.
Create the @Resources folder (if you don't already have it). Create a Fonts folder in this @Resources folder. Add the .ttf or .otf files of the fonts into this Fonts folder. If you did this, you can use them like they were installed on your computer. You can use them by FontFace=... options on String meters. See details here.
-
- Rainmeter Sage
- Posts: 16282
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
-
- Posts: 9
- Joined: October 15th, 2021, 2:41 pm
Re: I'm creating a clock, and need help
Yes! here's how it looks
and my final code:
Code: Select all
[Rainmeter]
Update1000
[MeasureTime]
Measure=Time
Format=%H%M%d%m
RegExpSubstitute=1
Substitute="^(.)(.*)$":"\1.\2"
[MeterTime1]
Meter= String
MeasureName= MeasureTime
FontFace= BONX-Silhouette
FontColor= 5F1515FF
Text = %1
FontSize = 22
FontWeight = 300
Antialias = 1
[MeterTime2]
Meter= String
MeasureName= MeasureTime
FontFace= BONX-Medium
FontColor= F27F2AFF
Text = %1
FontSize = 22
FontWeight = 300
Antialias = 1
[MeterTime3]
Meter= String
MeasureName= MeasureTime
FontFace= BONX-Frame
FontColor= 00000062
Text = %1
FontSize = 22
FontWeight = 50
Antialias = 1
-
- Rainmeter Sage
- Posts: 16282
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: I'm creating a clock, and need help
I don't have the used font, but I see two things related to the code:
- In the Update option of the [Rainmeter] section, the equality is missing: Update1000. Add it: Update=1000 (however even if you don't add it, the reult is the same, because in such cases Rainmeter uses the default value for the option, which in this case is Update=1000).
- There are three String meters ([MeterTime1], [MeterTime2] and [MeterTime3]), each with the same options, excepting the color and the FontWeight of the last meter. Worth this? Shouldn't those meters been moved little beat? For instance by adding the following options to [MeterTime2] and [MeterTime3]?
I mean that simply putting all those meters in the same position and applying the same options makes them to overlap each other. The meters located beneath are simply not visible. Maybe I missed the idea and additionally as said, I don't know how the meters are looking with the used font, but still...
Code: Select all
[MeterTime2] ... X=1r Y=1r ... [MeterTime3] ... X=-2r Y=-2r ...