It is currently September 16th, 2024, 7:12 pm

Nested Conditions + Formulas

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Nested Conditions + Formulas

Post by Yincognito »

sl23 wrote: July 19th, 2024, 3:55 pm Aha, solved it
:great:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16549
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Nested Conditions + Formulas

Post by balala »

sl23 wrote: July 19th, 2024, 3:50 pm

Code: Select all

[sBar]
Shape=Rectangle 0, 0, #BarW#, -#BarH# | StrokeWidth 0 | Fill Color #Bg#
Shape2=Rectangle 0, ([#CURRENTSECTION#Total]<1 ? 0.00001 : (([#CURRENTSECTION#Used:]/([#CURRENTSECTION#Total:]+0.000001)*#BarH#))), #BarW#, 2 | StrokeWidth 0 | Fill Color [#C[#CURRENTSECTION]]
DynamicVariables=1
Hidden=([#CURRENTSECTION#Total:]=0 ? 1 : 0)
X=([#CURRENTSECTION#Used:]=0 ? 0 : 2)R
Y=#BarH#
;X=([mFUsed:]/([mFTotal:]+0.00001)*150+15)
X=([mFTotal]<1 ? 0.00001 : (([#CURRENTSECTION#Used:]/([#CURRENTSECTION#Total:]+0.000001)*-#BarH#)))
[m1]
Meter=Shape
MeterStyle=sBar
X=0
The second occurrence of the X option is in vain. As usually, Rainmeter ignores it.
sl23 wrote: July 19th, 2024, 3:55 pm Aha, solved it, there was a missing : in balala's code! :D
In this one? Sorry, I took over the Formula from your post.
sl23 wrote: July 19th, 2024, 3:55 pm Thanks you so much for helping. :thumbup:
You're welcome from my part.
sl23 wrote: July 19th, 2024, 3:52 pm Yes, but I didn't know that having not used division for 35 years!
:o O.O :o
Yincognito wrote: July 19th, 2024, 3:51 pm Personally, I would write *(-#BarH#) instead. I'm not comfortable with two operations following immediately after one another, without some operation member between them.
You are not comfortable? Rainmeter isn't! The parenthesis are absolutely needed, otherwise the formula doesn't work.
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Nested Conditions + Formulas

Post by sl23 »

Thanks balala, I understand about several X lines of code. Just testing trying to get it working. Been trying all day! :? :lol: :thumbup:
57686174 77696C6C 6265 77696C6C 6265
User avatar
balala
Rainmeter Sage
Posts: 16549
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Nested Conditions + Formulas

Post by balala »

sl23 wrote: July 19th, 2024, 6:07 pm Been trying all day!
Good. We all do such things from time to time (me at least definitely do).
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Nested Conditions + Formulas

Post by Yincognito »

balala wrote: July 19th, 2024, 5:59 pm You are not comfortable? Rainmeter isn't! The parenthesis are absolutely needed, otherwise the formula doesn't work.
Well, I was trying to be gentle there. Too many mistakes for me to be straightforward about it, so I chose to be diplomatic instead. :confused:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16549
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Nested Conditions + Formulas

Post by balala »

Yincognito wrote: July 19th, 2024, 8:34 pm so I chose to be diplomatic instead.
:thumbup:
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Nested Conditions + Formulas

Post by sl23 »

...Thought it best to resurrect this thread as I have another issue with this but different skin.
Although I've used [#C[#CURRENTSECTION]] Variable successfully, I seem unable to get it working the other way: [#[#CURRENTSECTION]CPU]. This won't work and I have no idea how to make it work. Could you help please :thumbup:

Current Section = m1
Variable = m1CPU

I realised it should be like this: [#CURRENTSECTION[#CPU]], but that won't work either.

I've tried around 30 variations and nothing works. Why isn't this documented better! I keep having issues with it because there's very little info about how Nested Variables work. Sorry for my frustration. :oops:
57686174 77696C6C 6265 77696C6C 6265
User avatar
balala
Rainmeter Sage
Posts: 16549
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Nested Conditions + Formulas

Post by balala »

sl23 wrote: July 20th, 2024, 5:06 pm I seem unable to get it working the other way: [#[#CURRENTSECTION]CPU].
Extremely hard to say anything meaningful, because have no idea how your code looks like. On a first and extremely simple approach this is working for me, but there might be lot of details, which could make a difference. Check to have added a DynamicVariables=1 option to the not-working measure / meter and if still doesn't work, post a sample code please.
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Nested Conditions + Formulas

Post by sl23 »

Thanks balala, I ended up rewording the measures and variables to work the way I know works.
I just couldn't figure out what was doing wrong. Thanks anyway for your response :thumbup:
I'll be back... O.O
57686174 77696C6C 6265 77696C6C 6265
User avatar
balala
Rainmeter Sage
Posts: 16549
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Nested Conditions + Formulas

Post by balala »

sl23 wrote: July 20th, 2024, 8:22 pm Thanks balala, I ended up rewording the measures and variables to work the way I know works.
I just couldn't figure out what was doing wrong. Thanks anyway for your response :thumbup:
I'll be back... O.O
As you want...