It is currently April 18th, 2024, 6:25 pm
Substitute and leading zeros
-
- Posts: 2
- Joined: April 24th, 2010, 2:12 am
Substitute and leading zeros
I'm currently struggling my way through my first Rainmeter skin. I've hit a little snag though, I have a measure returning a value 1-31 to a calc measure, unfortunately due to the design of my skin I need the leading zero. Simply substituting 1-9 with 01-09 doesn't work for obvious reasons. There is probably an easy solution to this but I'm so brain dead from trying to learn everything else to see it. Thanks
-
- Moderator
- Posts: 1931
- Joined: January 29th, 2010, 1:43 am
- Location: Willmar, MN
Re: Substitute and leading zeros
Could you please post the appropriate portion of the code?
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Substitute and leading zeros
This should work:
[Rainmeter]
Author=JSMorley
Update=1000
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
; No idea how you are actually getting the number from 1-31, so here is a bunny with a pancake on its head...
[MeasureNumber]
Measure=Calc
Formula=Random
LowBound=1
HighBound=31
UpdateRandom=1
; Now turn the numbers from 1-31 to 0.01 to 0.31 and then substitute off the "0." on them
[MeasureAddLeadingZero]
Measure=Calc
Formula=(MeasureNumber / 100)
Substitute="0.":""
[MeterNumber]
Meter=String
MeasureName=MeasureAddLeadingZero
NumOfDecimals=2
FontSize=20
FontColor=255,255,255,255
Important bits in yellow. The rest is just bailing wire.
[Rainmeter]
Author=JSMorley
Update=1000
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
; No idea how you are actually getting the number from 1-31, so here is a bunny with a pancake on its head...
[MeasureNumber]
Measure=Calc
Formula=Random
LowBound=1
HighBound=31
UpdateRandom=1
; Now turn the numbers from 1-31 to 0.01 to 0.31 and then substitute off the "0." on them
[MeasureAddLeadingZero]
Measure=Calc
Formula=(MeasureNumber / 100)
Substitute="0.":""
[MeterNumber]
Meter=String
MeasureName=MeasureAddLeadingZero
NumOfDecimals=2
FontSize=20
FontColor=255,255,255,255
Important bits in yellow. The rest is just bailing wire.
-
- Posts: 2
- Joined: April 24th, 2010, 2:12 am
Re: Substitute and leading zeros
Ahh I was trying to think of a way to use decimals I shouldve came up with this. I gotta say rainmeter has some crazy poweful options but at the same time seems cryptic and sometimes lacking. Loving it so far though.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Substitute and leading zeros
It's true. The important thing is to go into it with the understanding that it isn't an application that displays widgets. Nor is it a programming language. It's more like Lego's or an Erector Set, and that special piece you really need just rolled under the couch..
-
- Developer
- Posts: 1270
- Joined: April 3rd, 2009, 4:31 am
- Location: NC, US
Re: Substitute and leading zeros
Yes, but if you are creative enough you can usually find a piece that can be used as a substitute for the missing one...