It is currently April 25th, 2024, 12:14 pm

Regarding If conditions

Get help with creating, editing & fixing problems with skins
User avatar
Alloutofmercy
Posts: 142
Joined: November 17th, 2021, 5:51 am

Re: Regarding If conditions

Post by Alloutofmercy »

but is this logic correct?

Used space + free space = total space

free space = total space - used space

used space = total space - free space


% of Total space = 100%

% of Free space = % of Total space - % of Used space and vicecerca

so what formula should i excatly use to caluclate % of free disk space in the calc measure?
BOOTY
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Regarding If conditions

Post by balala »

Alloutofmercy wrote: October 8th, 2022, 8:52 am ah iwanted it to be green when the free space is above 50% but made it become green if it was above 50% of used space !
Don't worry, it happens to everyone of us from time to time. But this was my thought as well:
balala wrote: October 6th, 2022, 7:24 pm In my opinion the color should be set to green when the FREE disk space is above 50%, to yellow below this and finally to red when this percent is below 15%.
Alloutofmercy wrote: October 8th, 2022, 9:07 am but is this logic correct?

Used space + free space = total space

free space = total space - used space

used space = total space - free space


% of Total space = 100%

% of Free space = % of Total space - % of Used space and vicecerca
It's correct.
Alloutofmercy wrote: October 8th, 2022, 9:07 am so what formula should i excatly use to caluclate % of free disk space in the calc measure?
There are many possibilities. But your formula used into the [MeasureUsedDiskPercentual] measure can be used, just have to modify the IfConditions:

Code: Select all

[MeasureUsedDiskPercentual]
Measure=Calc
Formula=Round(([MeasureUsedDiskSpace:]/[MeasureTotalDiskSpace:])*100,2)
DynamicVariables=1
IfCondition=(MeasureUsedDiskPercentual<50)
IfTrueAction=[!SetVariable "Bclr" "#green#"][!UpdateMeter "Drive1bar"][!Redraw]
IfCondition2=((MeasureUsedDiskPercentual>=50) && (MeasureUsedDiskPercentual<85))
IfTrueAction2=[!SetVariable "Bclr" "#yellow#"][!UpdateMeter "Drive1bar"][!Redraw]
IfCondition3=(MeasureUsedDiskPercentual>=85)
IfTrueAction3=[!SetVariable "Bclr" "#red#"][!UpdateMeter "Drive1bar"][!Redraw]
;OnUpdateAction=[!UpdateMeter Drive1bar][!Redraw]
See that:
  • I commented out the OnUpdateAction option. There is no need to update the [Drive1bar] meter on every update of the measure. The meter is anyway updated once per second, by thew normal update cycle, why to add another update through a bang?
  • I replaced the [!update] bangs in the IfTrueAction options by [!UpdateMeter "Drive1bar"][!Redraw]. There is no need to update the whole skin, updating the only meter which uses the set color is completely enough.
User avatar
Alloutofmercy
Posts: 142
Joined: November 17th, 2021, 5:51 am

Re: Regarding If conditions

Post by Alloutofmercy »

Thankyou! it really worked. so the problem was with the update bang and not the if conditions
BOOTY
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Regarding If conditions

Post by balala »

Alloutofmercy wrote: October 8th, 2022, 11:07 am so the problem was with the update bang and not the if conditions
I doubt, but if it's working, it's a good thing, I think.