It is currently March 28th, 2024, 9:10 am

Displaying a string

Get help with creating, editing & fixing problems with skins
DavidFw1960
Posts: 42
Joined: December 27th, 2016, 1:32 am

Displaying a string

Post by DavidFw1960 »

I'm using this as below...

Code: Select all

[MeterQuota]
Meter=STRING
MeasureName=MeasureTotalUsedGB
MeterStyle=styleLeftText
X=10
Y=13r
W=180
H=15
NumOfDecimals=2
Text=Data Used: %1 / 

[MeterQuota1]
Meter=STRING
MeasureName=MeasureQuotaUsedText
MeterStyle=styleRightText
X=180
Y=0r
W=180
H=15
Text=%1 GB
I was using a %1 and a %2 with one meter but the second term can be either text or a number - and I don't want to show any decimals at all.

So for instance the line could show:
Data Used: 189.45 / 800 GB
or
Data Used: 189.45 / Unlimited GB

But as I had them in one string with %1 %2 it was showing:
Data Used: 189.45 / Unlimited.00 GB
or
Data Used: 189.45 / 800.00 GB

What I am trying to make it show is:
Data Used: 189.45 / 800 GB
or
Data Used: 189.45 / Unlimited GB
Last edited by fonpaolo on May 14th, 2018, 11:06 am, edited 1 time in total.
Reason: Please use the [Code] tags to post your code.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Displaying a string

Post by balala »

Could you please post the whole code?
DavidFw1960
Posts: 42
Joined: December 27th, 2016, 1:32 am

Re: Displaying a string

Post by DavidFw1960 »

Not sure why you need the whole code but you can find it here:
https://github.com/DavidFW1960/Aussie-Broadband-Usage-Meter/blob/master/ABBUsage/ABB.ini
If anyone wants to look at my crappy code feel free to check it out and if you can suggest improvements that would be great.

Also I fixed it anyway. Just spent too much time looking at it I guess but this morning clear mind and I figured it out.

Code: Select all

[MeasureQuotaUsedText]
Measure=Calc
Formula=MeasureAllowanceGB
DynamicVariables=1
RegExpSubstitute=1
Substitute="100000":"Unlimited"

[MeasureQuotaString]
Measure=String
String=Data Used: [MeasureTotalUsedGB] / [MeasureQuotaUsedText] GB
DynamicVariables=1

[MeterQuota]
Meter=STRING
MeasureName=MeasureQuotaString
MeterStyle=styleLeftText
X=10
Y=13r
W=200
H=15
Last edited by fonpaolo on May 14th, 2018, 11:07 am, edited 1 time in total.
Reason: Please use the [Code] tags to post your code.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Displaying a string

Post by balala »

I can see a few issues:
  • I can't find the [MeterQuota1] meter (posted in your initial request) in your code. Doesn1t matter too much, because I think you'd like to use just the [MeterQuota] meter to show the result. Am I right?
  • The [MeterQuota] meter shows the value returned by the [MeasureQuotaString] String measure. You can't specify the number of shown decimals if you're displaying the result of a String measure. The result of this kind of measures isn't a number (that's why you can't apply the NumOfDecimals option, it simply doesn't work). As such I can't imagine how did you get the result(s) posted at the end of the initial request.
DavidFw1960 wrote:If anyone wants to look at my crappy code feel free to check it out and if you can suggest improvements that would be great.
A problem: a few of the options used into the [styleLeftText] and [styleRightText] sections are wrong. Probably you've mixed something on a copy / paste operation, because StringEffontEffectColorSett and FontEffontEffectColorSettColor options don't exist. Instead they should have to be StringEffect and FontEffectColor. Change them.
DavidFw1960
Posts: 42
Joined: December 27th, 2016, 1:32 am

Re: Displaying a string

Post by DavidFw1960 »

Yes I got rid of the [MeterQuota1] as I didn't end up needing it.

In my final code I'm not using a number of decimals for the [MeterQuota] Above what I quoted I multiple by 100, truncate and divide by 100 to get my 2 decimal places. It's now doing exactly what I want it to do.

Thanks for picking up my typos (cut/paste as you say). Fixed now but it doesn't seem to be displaying any differently anyway or at least I don't notice it.

Thanks for the help. Much appreciated.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Displaying a string

Post by balala »

DavidFw1960 wrote:In my final code I'm not using a number of decimals for the [MeterQuota] Above what I quoted I multiple by 100, truncate and divide by 100 to get my 2 decimal places. It's now doing exactly what I want it to do.
Great!
DavidFw1960 wrote:Thanks for picking up my typos (cut/paste as you say). Fixed now but it doesn't seem to be displaying any differently anyway or at least I don't notice it.
Without those options, the string is "plan". Adding them creates a shadow. The reason why you can't see it, is that the shadow is almost transparent, its color being fontEffectColorSet=0,0,0,20 (declared in the [Variables] section). This means that the shadow is black, but its transparency (the last value) is set to 20, from 255. This is almost invisible (a bit more precisely, almost transparent). Try to increase this value to 150 - 180, and the shadow will become well visible (fontEffectColorSet=0,0,0,150).
DavidFw1960
Posts: 42
Joined: December 27th, 2016, 1:32 am

Re: Displaying a string

Post by DavidFw1960 »

Hmm. Tried that. Also tried 255 and no visible difference.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Displaying a string

Post by balala »

DavidFw1960 wrote:Hmm. Tried that. Also tried 255 and no visible difference.
Has the background where the skin is placed approximatively the same color as the shadow? Has the background where the skin is placed the approximatively same color as the shadow? Because if you use a no close to transparent shadow, it is visible (I used them very often).
Eventually try to add the following two options into the [Rainmeter] section of the skin:

Code: Select all

[Rainmeter]
...
BackgroundMode=2
SolidColor=200,200,200,180
The SolidColor option gives a grey background to the skin and this way the shadow should have to become visible. Did it?
DavidFw1960
Posts: 42
Joined: December 27th, 2016, 1:32 am

Re: Displaying a string

Post by DavidFw1960 »

Yeah that was it. Thanks!
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Displaying a string

Post by balala »

DavidFw1960 wrote:Yeah that was it. Thanks!
Glad to help. Do you see now the shadow?
Post Reply