It is currently April 27th, 2024, 7:01 pm

I'm creating a clock, and need help

Get help with creating, editing & fixing problems with skins
User avatar
YRS1999
Posts: 9
Joined: October 15th, 2021, 2:41 pm

I'm creating a clock, and need help

Post by YRS1999 »

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?
User avatar
balala
Rainmeter Sage
Posts: 16178
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: I'm creating a clock, and need help

Post by balala »

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?
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:

Code: Select all

[MeasureHourDigit1]
Measure=Time
Format=%H
RegExpSubstitute=1
Substitute="^(.).$":"\1"

[MeasureHourDigit2]
Measure=Time
Format=%H
RegExpSubstitute=1
Substitute="^.(.)$":"\1"
With the above code, when the hour is 18 for example, [MeasureHourDigit1] returns 1 and [MeasureHourDigit2] returns 8.
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.
User avatar
YRS1999
Posts: 9
Joined: October 15th, 2021, 2:41 pm

Re: I'm creating a clock, and need help

Post by YRS1999 »

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:

Code: Select all

[MeasureHourDigit1]
Measure=Time
Format=%H
RegExpSubstitute=1
Substitute="^(.).$":"\1"

[MeasureHourDigit2]
Measure=Time
Format=%H
RegExpSubstitute=1
Substitute="^.(.)$":"\1"
With the above code, when the hour is 18 for example, [MeasureHourDigit1] returns 1 and [MeasureHourDigit2] returns 8.
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.
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?
User avatar
YRS1999
Posts: 9
Joined: October 15th, 2021, 2:41 pm

Re: I'm creating a clock, and need help

Post by YRS1999 »

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:

Code: Select all

[MeasureHourDigit1]
Measure=Time
Format=%H
RegExpSubstitute=1
Substitute="^(.).$":"\1"

[MeasureHourDigit2]
Measure=Time
Format=%H
RegExpSubstitute=1
Substitute="^.(.)$":"\1"
With the above code, when the hour is 18 for example, [MeasureHourDigit1] returns 1 and [MeasureHourDigit2] returns 8.
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.
Thanks, I was able to come up with the code that I'm satisfied with:

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
Just wondering, I'd like to add same text on top of each other so its overlapping, with copying and pasting the MeterTime multiple times do it? (With different fonts)
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?
User avatar
balala
Rainmeter Sage
Posts: 16178
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: I'm creating a clock, and need help

Post by balala »

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?
For this you have to create just one single Time measure. Like this one:

Code: Select all

[MeasureTime]
Measure=Time
Format=%H%M%d%m
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
RegExpSubstitute=1
Substitute="^(.)(.*)$":"\1.\2"
Not sure what this is good for, but can be done.
With this approach, the [MeterTime] meter should have one single MeasureName option:

Code: Select all

[MeterTime]
Meter= String
MeasureName= MeasureTime
Text = %1
FontSize = 18
The dot is added by the Substitute option of the [MeasureTime] measure, no need to add it into the String meter.
YRS1999 wrote: January 4th, 2024, 4:44 pm Just wondering, I'd like to add same text on top of each other so its overlapping, with copying and pasting the MeterTime multiple times do it? (With different fonts)
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.
YRS1999 wrote: January 4th, 2024, 4:44 pm 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?
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.
User avatar
YRS1999
Posts: 9
Joined: October 15th, 2021, 2:41 pm

Re: I'm creating a clock, and need help

Post by YRS1999 »

balala wrote: January 4th, 2024, 5:21 pm For this you have to create just one single Time measure. Like this one:

Code: Select all

[MeasureTime]
Measure=Time
Format=%H%M%d%m
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
RegExpSubstitute=1
Substitute="^(.)(.*)$":"\1.\2"
Not sure what this is good for, but can be done.
With this approach, the [MeterTime] meter should have one single MeasureName option:

Code: Select all

[MeterTime]
Meter= String
MeasureName= MeasureTime
Text = %1
FontSize = 18
The dot is added by the Substitute option of the [MeasureTime] measure, no need to add it into the String meter.

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.
Thanks, man!
User avatar
balala
Rainmeter Sage
Posts: 16178
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: I'm creating a clock, and need help

Post by balala »

YRS1999 wrote: January 4th, 2024, 5:37 pmThanks, man!
Did you succeed in getting it to work?
User avatar
YRS1999
Posts: 9
Joined: October 15th, 2021, 2:41 pm

Re: I'm creating a clock, and need help

Post by YRS1999 »

balala wrote: January 4th, 2024, 6:28 pm Did you succeed in getting it to work?
Yes! here's how it looks
Image

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
User avatar
balala
Rainmeter Sage
Posts: 16178
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: I'm creating a clock, and need help

Post by balala »

YRS1999 wrote: January 5th, 2024, 11:25 am and my final code:
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]?

    Code: Select all

    [MeterTime2]
    ...
    X=1r
    Y=1r
    ...
    
    [MeterTime3]
    ...
    X=-2r
    Y=-2r
    ...
    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...