It is currently April 19th, 2024, 7:40 am

Recycle manager help

Get help with creating, editing & fixing problems with skins
Sunspot2
Posts: 46
Joined: January 29th, 2010, 3:39 pm

Recycle manager help

Post by Sunspot2 »

I give up.
Been trying to do this for myself, but cannot figure out how to solve this:

I have a recycle bin config that shows:

"No Items to Recycle" when the trash is empty
"1 Item to Recycle" when there's 1 item in the trash
"X Items to Recycle" when there's X items in the trash

I got this from the topic http://rainmeter.net/forum/viewtopic.php?t=2783

But the Substitute="0":"" part give me the problem that when i have 10 items in the Trash i got the message "1 Items to Recycle"
Been trying to solve this by myself for days, but i really need help, cannot solve it on my own.
Anybody can give me some hints?
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Recycle manager help

Post by JpsCrazy »

I have no idea how to fix it, but I'm guessing there's just not enough space for it to show. Does 11 or more work?
Sunspot2
Posts: 46
Joined: January 29th, 2010, 3:39 pm

Re: Recycle manager help

Post by Sunspot2 »

yep, even "358 Items" shows, but 360 shows as "36 Items"

It's because of the -- Substitute="0":""

I dont know how to make valid for value equal 0, and invalid for value above 0
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Recycle manager help

Post by smurfier »

Substitute does not match the whole number, but every single character, and also matches in order.
Try: Substitute="000":"000","00":"00","10":"10,"20":"20","30":30","40":"40","50":"50","60":"60","70":"70","80":"80","90":"90","0":""

Problem is that this will not work for numbers such as 306. As far as I know, there is no easy way.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Recycle manager help

Post by dragonmage »

You will need a separate meter for "No Items To Recycle." Start it hidden. On your measure that gets the file count use

Code: Select all

IfEqualValue=0
IfEqualAction=!Execute [!RainmeterHideMeter Meter that displays filecount][!RainmeterShowMeter No Items Meter]
IfAboveValue=0
IfAboveAction=!Execute (use the reverse of the above)
Remove the Substitute.
Sunspot2
Posts: 46
Joined: January 29th, 2010, 3:39 pm

Re: Recycle manager help

Post by Sunspot2 »

Tried both ways and when it's empty it shows "0 No Items to Recycle"
I also tried to add:

IfEqualValue=0
IfEqualAction=!Execute [!RainmeterHideMeter RecycleMeter][!RainmeterShowMeter NoItemsMeter][!RainmeterRedraw]
IfAboveValue=0
IfAboveAction=!Execute [!RainmeterHideMeter NoItemsMeter][!RainmeterShowMeter RecycleMeter][!RainmeterRedraw]

and to remove Substitute, didnt worked
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Recycle manager help

Post by dragonmage »

Post the code here between

Code: Select all

 tags please
Sunspot2
Posts: 46
Joined: January 29th, 2010, 3:39 pm

Re: Recycle manager help

Post by Sunspot2 »

This is the code after your sugestion:

Code: Select all

;[BEGIN CONFIG FILE]==============================

[Rainmeter]
Author=Jeffrey Morley (modified by Sunspot2)
BackgroundMode=1
Update=100
AppVersion=1.1
MouseActionCursor=0

;Metadata added by RainBrowser
;http://rainmeter.net/RainWiki/index.php?title=Rainmeter_101#.5BMetadata.5D

[Metadata]
Name=
Config=
Description=
Instructions=
Version=
Tags=
License=
Variant=
Preview=

;End of added Metadata

[Variables]
@Include="..\UserVariables.inc"
Postfix=Item

[MeasureBin]
Measure=Plugin
Plugin=RecycleManager.dll
Drives=ALL
RecycleType=COUNT
IfEqualValue=0
IfEqualAction=!Execute [!RainmeterHideMeter RecycleMeter][!RainmeterShowMeter NoItemsMeter][!RainmeterRedraw]
IfAboveValue=0
IfAboveAction=!Execute [!RainmeterHideMeter NoItemsMeter][!RainmeterShowMeter RecycleMeter][!RainmeterRedraw]

[PostfixEmpty]
Measure=Calc
Formula=MeasureBin
IfEqualAction=!RainmeterSetVariable Postfix "No Items to Recycle"
ifEqualValue=0

[PostfixOne]
Measure=Calc
Formula=MeasureBin
IfEqualAction=!RainmeterSetVariable Postfix "Item to Recycle"
ifEqualValue=1

[PostfixMany]
Measure=Calc
Formula=MeasureBin
IfAboveAction=!RainmeterSetVariable Postfix "Items to Recycle"
IfAboveValue=1

[MeasureSize]
Measure=Plugin
Plugin=RecycleManager.dll
Drives=ALL
RecycleType=SIZE

;METERS+++++++++++++

[MeterBlack]
Meter=IMAGE
X=0
Y=0
W=150
H=134
SolidColor=0, 0, 0, 2

[StatusText]
Meter=STRING
X=141
Y=59
FontColor=#FontColor1#
StringStyle=NORMAL
Fontsize=11
StringAlign=RIGHT
FontFace=#FontFace#
Text="Status"
AntiAlias=1

[RecycleMeter]
Meter=String
MeasureName=MeasureBin
FontColor=#FontColor1#
FontSize=10
FontFace=#FontFace#
StringStyle=normal
StringAlign=Center
X=75
Y=104
DynamicVariables=1
Text=%1 #PostFix#
AntiAlias=1

[RecycleMeter]
Meter=String
FontColor=#FontColor1#
FontSize=10
FontFace=#FontFace#
StringStyle=normal
StringAlign=Center
X=75
Y=104
Text="No Items to Recycle
AntiAlias=1

[MeterSize]
Meter=STRING
MeasureName=MeasureSize
FontColor=#FontColor1#
FontSize=11
FontFace=#FontFace#
StringStyle=BOLD
StringAlign=RIGHT
X=141
Y=80
Text=%1
Postfix="B"
AutoScale=1
AntiAlias=1
NumOfDecimals=2

[MeterBinEmpty]
Meter=IMAGE
ImageName=RecyclebS.png
X=2
Y=33
W=64
H=64
Hidden=0
LeftMouseDownAction=!execute [!RainmeterPluginBang "MeasureBin OpenBin"]

[MeterBinFull]
Meter=IMAGE
ImageName=RecycleFullbS.png
X=2
Y=33
W=64
H=64
Hidden=1
LeftMouseDownAction=!execute [!RainmeterPluginBang "MeasureBin OpenBin"]
RightMouseUpAction=!execute [!RainmeterPluginBang "MeasureBin EmptyBin"]

[BinAction]
Measure=Calc
Formula=MeasureBin
IfAboveAction=!execute [!RainmeterHideMeter MeterBinEmpty][!RainmeterShowMeter MeterBinFull]
IfAboveValue=0
IfEqualAction=!execute [!RainmeterHideMeter MeterBinFull][!RainmeterShowMeter MeterBinEmpty]
IfEqualValue=0

;[END CONFIG FILE]==============================
This is the original one:

Code: Select all

;[BEGIN CONFIG FILE]==============================

[Rainmeter]
Author=Jeffrey Morley (modified by Sunspot2)
BackgroundMode=1
Update=100
AppVersion=1.1
MouseActionCursor=0

;Metadata added by RainBrowser
;http://rainmeter.net/RainWiki/index.php?title=Rainmeter_101#.5BMetadata.5D

[Metadata]
Name=
Config=
Description=
Instructions=
Version=
Tags=
License=
Variant=
Preview=

;End of added Metadata

[Variables]
@Include="..\UserVariables.inc"
Postfix=Item

[MeasureBin]
Measure=Plugin
Plugin=RecycleManager.dll
Drives=ALL
RecycleType=COUNT
Substitute="0":""

[PostfixEmpty]
Measure=Calc
Formula=MeasureBin
IfEqualAction=!RainmeterSetVariable Postfix "No Items to Recycle"
ifEqualValue=0

[PostfixOne]
Measure=Calc
Formula=MeasureBin
IfEqualAction=!RainmeterSetVariable Postfix "Item to Recycle"
ifEqualValue=1

[PostfixMany]
Measure=Calc
Formula=MeasureBin
IfAboveAction=!RainmeterSetVariable Postfix "Items to Recycle"
IfAboveValue=1

[MeasureSize]
Measure=Plugin
Plugin=RecycleManager.dll
Drives=ALL
RecycleType=SIZE

;METERS+++++++++++++

[MeterBlack]
Meter=IMAGE
X=0
Y=0
W=150
H=134
SolidColor=0, 0, 0, 2

[StatusText]
Meter=STRING
X=141
Y=59
FontColor=#FontColor1#
StringStyle=NORMAL
Fontsize=11
StringAlign=RIGHT
FontFace=#FontFace#
Text="Status"
AntiAlias=1

[RecycleMeter]
Meter=String
MeasureName=MeasureBin
FontColor=#FontColor1#
FontSize=10
FontFace=#FontFace#
StringStyle=normal
StringAlign=Center
X=75
Y=104
DynamicVariables=1
Text=%1 #PostFix#
AntiAlias=1

[MeterSize]
Meter=STRING
MeasureName=MeasureSize
FontColor=#FontColor1#
FontSize=11
FontFace=#FontFace#
StringStyle=BOLD
StringAlign=RIGHT
X=141
Y=80
Text=%1
Postfix="B"
AutoScale=1
AntiAlias=1
NumOfDecimals=2

[MeterBinEmpty]
Meter=IMAGE
ImageName=RecyclebW.png
X=2
Y=33
W=64
H=64
Hidden=0
LeftMouseDownAction=!execute [!RainmeterPluginBang "MeasureBin OpenBin"]

[MeterBinFull]
Meter=IMAGE
ImageName=RecycleFullbW.png
X=2
Y=33
W=64
H=64
Hidden=1
LeftMouseDownAction=!execute [!RainmeterPluginBang "MeasureBin OpenBin"]
RightMouseUpAction=!execute [!RainmeterPluginBang "MeasureBin EmptyBin"]

[BinAction]
Measure=Calc
Formula=MeasureBin
IfAboveAction=!execute [!RainmeterHideMeter MeterBinEmpty][!RainmeterShowMeter MeterBinFull]
IfAboveValue=0
IfEqualAction=!execute [!RainmeterHideMeter MeterBinFull][!RainmeterShowMeter MeterBinEmpty]
IfEqualValue=0

;[END CONFIG FILE]==============================
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Recycle manager help

Post by Alex2539 »

Get rid of the substitute on [MeasureBin]. Then, add a new calc measure:

Code: Select all

[MeasureBinNoZero]
Measure=Calc
Formula=(MeasureBin=0?(-1):MeasureBin)
Substitute="-1":""
Then, under [RecycleMeter] change "MeasureName=MeasureBin" to "MeasureName=MeasureBinNoZero".

What that statement does is check if MeasureBin is zero. If it is, it makes the value -1. Otherwise, it keeps the value of MeasureBin. Then you can safely substitute "-1" away since it's impossible to have a negative number of items in the recycle bin.
ImageImageImageImage
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Recycle manager help

Post by dragonmage »

...or that