how can i make a measureable number with additional "0" on the displayed text?
example : displayed "0005" second instead "5" second , displayed "050.5" gb instead "50.5" gb
if its cannot be undone, can i make an extra string instead for the "0" extension?
It is currently April 19th, 2024, 2:21 am
Number measure extension "0"
-
- Posts: 21
- Joined: July 8th, 2018, 6:09 am
-
- Rainmeter Sage
- Posts: 16144
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Number measure extension "0"
It can be, you just have to add a substitution to the measure which returns the number. For instance with the following two options added, the measure will get three zeros before the number:Mekurukito wrote: ↑November 13th, 2019, 11:33 am how can i make a measureable number with additional "0" on the displayed text?
example : displayed "0005" second instead "5" second , displayed "050.5" gb instead "50.5" gb
if its cannot be undone, can i make an extra string instead for the "0" extension?
Code: Select all
[MeasureSomething]
...
RegExpSubstitute=1
Substitute="^(.*)$":"000\1"
-
- Posts: 21
- Joined: July 8th, 2018, 6:09 am
Re: Number measure extension "0"
thank you for the answer, i have a new question
is it possible to delete disk symbol "g"?
example : it show "5.0" instead of "5.0 G"
is it possible to delete disk symbol "g"?
example : it show "5.0" instead of "5.0 G"
-
- Posts: 21
- Joined: July 8th, 2018, 6:09 am
Re: Number measure extension "0"
i think this is not a good solve for what i aimingbalala wrote: ↑November 13th, 2019, 12:54 pm It can be, you just have to add a substitution to the measure which returns the number. For instance with the following two options added, the measure will get three zeros before the number:This adds three zeros, because in the Substitute option I added three zeros in front of \1. If you want a different number of zeros, add the appropriate number of zeros.Code: Select all
[MeasureSomething] ... RegExpSubstitute=1 Substitute="^(.*)$":"000\1"
i want to make it real calculation,
like its supposed to be "062gb" not "00062gb"...
-
- Rainmeter Sage
- Posts: 16144
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Number measure extension "0"
Please post a complete code. I suppose in the above string ("5.0 G"), the G is not the disk symbol, but a scaling Giga prefix. If this is so, the G is introduced by the String meter, through an AutoScale=1 option, so there is nothing to be deleted.Mekurukito wrote: ↑November 13th, 2019, 1:53 pm is it possible to delete disk symbol "g"?
example : it show "5.0" instead of "5.0 G"
Anyway first a code would be needed. Please post it.
-
- Rainmeter Sage
- Posts: 16144
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Number measure extension "0"
You mean the number of zeros should depend on how many letters (symbols, characters) are in the string? I'm not sure I understood this request.
-
- Posts: 21
- Joined: July 8th, 2018, 6:09 am
Re: Number measure extension "0"
Yeah, its suppose to be depend on the number, like a digital clock it can show like "00:30" but im trying if i can do it for a simple measure number like measuring total of hard drive data
-
- Posts: 134
- Joined: June 30th, 2014, 8:44 am
Re: Number measure extension "0"
This is extremely simple.
I left comments so it should be reasonably simple to understand.
Code: Select all
[Rainmeter]
Update = -1
[DoIt]
Measure = String
String = 34
RegExpSubstitute = 1
; Add as many zeroes as you want
; Just make sure you add enough to get as many digits
; as you plan to have.
; The first substitute grabs the entire string and adds zeroes to the front
; The second substitute grabs the last four numbers
; For more/less numbers just change the {4} to whatever you want
Substitute = "(.*)" : "0000000\1", ".*[0-9]([0-9]{4})" : "\1"
[ShowIt]
Meter = String
Text = [DoIt]
FontSize = 15
[DoItTrailing]
Measure = String
String = 34gb
RegExpSubstitute = 1
; Add as many zeroes as you want
; Just make sure you add enough to get as many digits
; as you plan to have.
; The first substitute grabs the entire string and adds zeroes to the front
; The second substitute grabs the last four numbers as well as the trailing text
; For more/less numbers just change the {4} to whatever you want
Substitute = "(.*)" : "0000000\1", ".*[0-9]([0-9]{4})(.*)" : "\1\2"
[ShowItTrailing]
Meter = String
Text = [DoItTrailing]
Y = 20r
FontSize = 15
I left comments so it should be reasonably simple to understand.
-
- Posts: 134
- Joined: June 30th, 2014, 8:44 am
Re: Number measure extension "0"
Actually, I overengineered it just a little bit.
If you change the name of the DoIt measure make sure you change the [DoIt:MinValue] as well to reflect the new name in the third substitute. If you name the measure ZeroLeader then change it to [ZeroLeader:MinValue]. Doesn't matter, just make sure you're aware. Can't use #CURRENTSECTION# in a regex so gotta do it manually unfortunately.
Substitute = "(.*)" : "000000000000\1", "^(0*)(.*)" : "\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\2", ".*[0-9]([0-9]{[DoIt:MinValue]}.*)" : "\1"
You can change how much padding you have by changing the MinValue on the [DoIt] measure. You can do this by manually typing it in, or by using the !SetOption bang. Change that number to however many digits you want, total. If you want 0023 then that's 4.
Then make sure that DoIt gets the right text in the String option, either by using DynamicVariables with the name of a measure/variable as a parameter or through the use of !SetOption or the like.
Any trailing text after the number will be preserved - gb, kb, mb, am, pm, whatever.
If you need help making it work then just lemme know, but try to be more descriptive and provide code examples.
If you change the name of the DoIt measure make sure you change the [DoIt:MinValue] as well to reflect the new name in the third substitute. If you name the measure ZeroLeader then change it to [ZeroLeader:MinValue]. Doesn't matter, just make sure you're aware. Can't use #CURRENTSECTION# in a regex so gotta do it manually unfortunately.
Substitute = "(.*)" : "000000000000\1", "^(0*)(.*)" : "\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\2", ".*[0-9]([0-9]{[DoIt:MinValue]}.*)" : "\1"
You can change how much padding you have by changing the MinValue on the [DoIt] measure. You can do this by manually typing it in, or by using the !SetOption bang. Change that number to however many digits you want, total. If you want 0023 then that's 4.
Then make sure that DoIt gets the right text in the String option, either by using DynamicVariables with the name of a measure/variable as a parameter or through the use of !SetOption or the like.
Any trailing text after the number will be preserved - gb, kb, mb, am, pm, whatever.
If you need help making it work then just lemme know, but try to be more descriptive and provide code examples.
Code: Select all
[Rainmeter]
Update = -1
[DoIt]
Measure = String
String = 34gb
RegExpSubstitute = 1
MinValue = 4
; The first substitute grabs the entire string and adds zeroes to the front
; The second substitute grabs the leading zeroes and duplicates them several times
; to ensure we have enough leading zeroes for all use cases
; Then finally the third substitute removes all but the last X digits
; Where X is the MinValue on this measure
Substitute = "(.*)" : "000000000000\1", "^(0*)(.*)" : "\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\2", ".*[0-9]([0-9]{[DoIt:MinValue]}.*)" : "\1"
[ShowIt]
Meter = String
Text = [DoIt]
FontSize = 15
SolidColor = 0,0,0,1
-
- Rainmeter Sage
- Posts: 16144
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Number measure extension "0"
Instead of an overcomplicated approach, I'd use a following kind of substitution: Substitute="^(.{5})$":"0\1","^(.{4})$":"00\1","^(.{3})$":"000\1","^(.{2})$":"0000\1","^(.{1})$":"00000\1".Mekurukito wrote: ↑November 14th, 2019, 2:48 am Yeah, its suppose to be depend on the number, like a digital clock it can show like "00:30" but im trying if i can do it for a simple measure number like measuring total of hard drive data
What this substitution does?
First it checks if the value returned by the measure where it is added has five characters (in the .{5} expression, . means any character, {5} means there are five characters). If the value has indeed five characters, this substitution is made and in front of the string (wrote as \1 in the second part of the substitution) is added a zero. If the string has four characters, the first substitution is ignored, but the second one is executed. In this case two zeros are added before the string (due to the 00\1 value). Same way, if there are three characters, three zeros are added (being executed the "^(.{3})$":"000\1" substitution), for two characters four zeros ("^(.{2})$":"0000\1") and finally for one single character, five zeros are added ("^(.{1})$":"00000\1").
Obviously you have to rewrite the zeros if different number of them are required. And further substitutions are also required if more zeros have to be added. But this is the basic of a such procedure to get zeros in front of the string returned by a measure.