It is currently October 19th, 2020, 9:32 pm

Help with recycle bin image if condition

Help with creating, editing & fixing problems with skins
achintyagk
Posts: 9
Joined: November 30th, 2014, 12:08 pm

Help with recycle bin image if condition

Post by achintyagk »

Hi,

I'm trying to make a Recycle Bin skin which changes to reflect how full the bin is. For example, if the recycle bin has items which collectively are equal to or less than 256 MB, I want it to show an image which looks quarter full. If it's less than 512 MB, I want it to show an image which looks half full. If it's less than 768 MB I want it to show a three quarters full recycle bin and if it's above 768 MB, I want it to show a full recycle bin. I've already made the icons in photoshop. I tried if conditions, but they don't seem to work. Can anyone please help?

Here's my code.

Code: Select all

[Rainmeter]
Update=3000

;______________________________;
;-------VARIABLES------;

[Variables]
Imgname=#@#Images\Recycle Bin Empty.png

;______________________________;
;-------MEASURES-------;


[measureBinSize]
; Returns the total size of the Recycle Bin in bytes.
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=Size
UpdateDivider=3
IfCondition=(MeasureBinSize = 0)
IfTrueAction=[!SetVariable Imgname "#@#Images\Recycle Bin Empty.png"]
IfCondition=(MeasureBinSize > 0) && (MeasureBinSize <= 268435456)
IfTrueAction=[!SetVariable Imgname "#@#Images\Recycle Bin One Quarter.png"]
IfCondition=(MeasureBinSize > 268435456) && (MeasureBinSize <= 536870912)
IfTrueAction=[!SetVariable Imgname "#@#Images\Recycle Bin Half.png"]
IfCondition=(MeasureBinSize > 536870912) && (MeasureBinSize <= 805306368)
IfTrueAction=[!SetVariable Imgname "#@#Images\Recycle Bin Three Quarters.png"]
IfCondition=MeasureBinSize > 805306368
IfTrueAction=[!SetVariable Imgname "#@#Images\Recycle Bin Full.png"]
OnUpdateAction=[!UpdateMeter MeterImage][!Redraw]

[MeterImage]
Meter=Image
ImageName=#Imgname#
H=100
PreserveAspectRatio=1
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 11575
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with recycle bin image if condition

Post by balala »

The IfCondition / IfTrueAction options must be numbered:

Code: Select all

[measureBinSize]
; Returns the total size of the Recycle Bin in bytes.
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=Size
UpdateDivider=3
IfCondition=(MeasureBinSize = 0)
IfTrueAction=[!SetVariable Imgname "#@#Images\Recycle Bin Empty.png"]
IfCondition2=(MeasureBinSize > 0) && (MeasureBinSize <= 268435456)
IfTrueAction2=[!SetVariable Imgname "#@#Images\Recycle Bin One Quarter.png"]
IfCondition3=(MeasureBinSize > 268435456) && (MeasureBinSize <= 536870912)
IfTrueAction3=[!SetVariable Imgname "#@#Images\Recycle Bin Half.png"]
IfCondition4=(MeasureBinSize > 536870912) && (MeasureBinSize <= 805306368)
IfTrueAction4=[!SetVariable Imgname "#@#Images\Recycle Bin Three Quarters.png"]
IfCondition5=MeasureBinSize > 805306368
IfTrueAction5=[!SetVariable Imgname "#@#Images\Recycle Bin Full.png"]
OnUpdateAction=[!UpdateMeter MeterImage][!Redraw]
achintyagk
Posts: 9
Joined: November 30th, 2014, 12:08 pm

Re: Help with recycle bin image if condition

Post by achintyagk »

That worked! Thank you so much!
achintyagk
Posts: 9
Joined: November 30th, 2014, 12:08 pm

Re: Help with recycle bin image if condition

Post by achintyagk »

Now there's another problem. When I delete 2 files of 200 MB each one by one, it shows the hall full image, as it should, but if I restore only one of the files from the recycle bin, it keeps showing the half full image instead of the quarter full image (since the file size is less than 256). Refreshing doesn't work, and the only way to make it show the correct image is by either restoring or deleting every file from the recycle bin, so that it's empty. Could you help please?
User avatar
balala
Rainmeter Sage
Posts: 11575
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with recycle bin image if condition

Post by balala »

achintyagk wrote:When I delete 2 files of 200 MB each one by one, it shows the hall full image, as it should, but if I restore only one of the files from the recycle bin, it keeps showing the half full image instead of the quarter full image (since the file size is less than 256). Refreshing doesn't work, and the only way to make it show the correct image is by either restoring or deleting every file from the recycle bin, so that it's empty. Could you help please?
I'm not entirely sure what's going on, but it seems you're right. If I'm not wrong, a while ago here on the forum we had a post about a bug of the RecycleManager plugin. I can't remember what have I read and now I can't find that post, but I think I've read something like this.
Maybe someone who knows better what's going on, will come to clarify...
User avatar
jsmorley
Developer
Posts: 21421
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help with recycle bin image if condition

Post by jsmorley »

User avatar
balala
Rainmeter Sage
Posts: 11575
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with recycle bin image if condition

Post by balala »

I think this is exactly the post I remember I saw, but couldn't find. Even if I was wrong remembering it was about a bug.... :thumbup:
achintyagk
Posts: 9
Joined: November 30th, 2014, 12:08 pm

Re: Help with recycle bin image if condition

Post by achintyagk »

Oh. Thanks anyway! You've both been of immense help! I guess I'll just keep the recycle bin as is. I was wondering why there isn't many recycle bin skins like what I was trying to make. Perhaps this is why? Anyhow, thanks once again!
achintyagk
Posts: 9
Joined: November 30th, 2014, 12:08 pm

Re: Help with recycle bin image if condition

Post by achintyagk »

balala wrote:The IfCondition / IfTrueAction options must be numbered:

Code: Select all

[measureBinSize]
; Returns the total size of the Recycle Bin in bytes.
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=Size
UpdateDivider=3
IfCondition=(MeasureBinSize = 0)
IfTrueAction=[!SetVariable Imgname "#@#Images\Recycle Bin Empty.png"]
IfCondition2=(MeasureBinSize > 0) && (MeasureBinSize <= 268435456)
IfTrueAction2=[!SetVariable Imgname "#@#Images\Recycle Bin One Quarter.png"]
IfCondition3=(MeasureBinSize > 268435456) && (MeasureBinSize <= 536870912)
IfTrueAction3=[!SetVariable Imgname "#@#Images\Recycle Bin Half.png"]
IfCondition4=(MeasureBinSize > 536870912) && (MeasureBinSize <= 805306368)
IfTrueAction4=[!SetVariable Imgname "#@#Images\Recycle Bin Three Quarters.png"]
IfCondition5=MeasureBinSize > 805306368
IfTrueAction5=[!SetVariable Imgname "#@#Images\Recycle Bin Full.png"]
OnUpdateAction=[!UpdateMeter MeterImage][!Redraw]
Just uploaded my skin to DeviantArt! Here it is!

Image