It is currently November 29th, 2021, 6:05 am

Substitute and leading zeros

Help with creating, editing & fixing problems with skins
demitrix
Posts: 2
Joined: April 24th, 2010, 2:12 am

Substitute and leading zeros

Post by demitrix »

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
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Substitute and leading zeros

Post by smurfier »

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 . . .
User avatar
jsmorley
Developer
Posts: 22414
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Substitute and leading zeros

Post by jsmorley »

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.
demitrix
Posts: 2
Joined: April 24th, 2010, 2:12 am

Re: Substitute and leading zeros

Post by demitrix »

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.
User avatar
jsmorley
Developer
Posts: 22414
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Substitute and leading zeros

Post by jsmorley »

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..

;-)
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Substitute and leading zeros

Post by dragonmage »

Yes, but if you are creative enough you can usually find a piece that can be used as a substitute for the missing one...