It is currently April 8th, 2020, 1:11 am

2 Problems in 1 Code

Get help with installing and using Rainmeter.
User avatar
balala
Rainmeter Sage
Posts: 10093
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: 2 Problems in 1 Code

Post by balala »

Enno wrote:
December 25th, 2019, 8:43 am
But 1st the meterTitle will only show %1
Just a few explanations on why this gone on. So let's take mak_kawa's reply:
mak_kawa wrote:
December 25th, 2019, 10:41 am
Structure of [measureDisplayName] measure is incorrect.
Well, in fact [measureDisplayName] isn't even a measure. From the point of view of Rainmeter, [measureDisplayName] is nothing. In the original posted code, [measureDisplayName] looks like:

Code: Select all

[measureDisplayName]
Measure=measureName
Measure2=measureChargeCurrentRequest
Measure3=measureChargePower
IfCondition=(%3 > 0)
IfTrueAction=[!SetOption meterTitle Text "%1 lädt mit %2A/%3KW"]
Measure=measureName makes no sense at all, because a Measure= option should define the measure type, Calc, String or whatever. Even if the existing [measureName] measure would return the name of a valid measure type (like mentioned previously Calc, String or whatever), which I doubt, but let's just suppose it does, the Measure=measureName option just wouldn't work. Not even Measure=[measureName] would, especially not if a DynamicVariable=1 isn't added. Measure=Something has always to be set explicitly. Additionally options like Measure2, Measure3 nowhere exist. These can't be used on no measure type. Don't make too much sense. MeasureName2, MeasureName3 yes, on String measures for instance, but Measure2, Measure3 and so on, NO!
Secondly IfCondition=(%3 > 0) again doesn't make sense. In IfCondition you have to precise the name of the measure you'd like to compare. In this case theoretically IfCondition=(measureChargePower > 0), but because [measureChargePower] is a WebParser measure (also although it does work, take care that WebParser isn't anymore a plugin as it was once, but a measure) you have to make the conversion this way IfCondition=([measureChargePower] > 0), which also requires to set on the dynamic variables, as mak_kawa did.
User avatar
balala
Rainmeter Sage
Posts: 10093
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: 2 Problems in 1 Code

Post by balala »

mak_kawa wrote:
December 25th, 2019, 11:22 am
Probably balala will correct my post...:-)

[measureDisplayName] is not necessary at all. Ifcondition expression is better to be located in [measureChargePower] measure itself, like this.
Thank you for the trust.
Note that as I explained above, because [measureChargePower] is a WebParser measure, the IfCondition=(measureChargePower > 0) condition probably doesn't work, because the value of the [measureChargePower] measure should be converted to a number. This can be done easily, as you did previously: IfCondition=([measureChargePower] > 0). This requires to add back the DynamicVariables=1 option as well.
An additional note: in such cases I always prefer to use the condition as IfCondition=([#CURRENTSECTION#] > 0). Just a small trick, but this makes much more easier to move the condition to another section, if needed.
Enno
Posts: 5
Joined: December 25th, 2019, 8:36 am

Re: 2 Problems in 1 Code

Post by Enno »

Whoop! Thanks.
works fine to.

okay i will try to understand the new code.
I hope i will learn a little bit.

Thanks for all your replies
and a merry christmas to all of you and your beloved.
User avatar
balala
Rainmeter Sage
Posts: 10093
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: 2 Problems in 1 Code

Post by balala »

Enno wrote:
December 25th, 2019, 6:34 pm
okay i will try to understand the new code.
I hope i will learn a little bit.
You can to come back whenever you have questions.
If you're interested, there are a lot of things to be learnt. Feel free to explore...
Enno wrote:
December 25th, 2019, 6:34 pm
and a merry christmas to all of you and your beloved.
Merry Christmas to you too.