It is currently March 28th, 2024, 10:16 am

Autohide drives when unplugged?

Get help with creating, editing & fixing problems with skins
User avatar
GioRgSaVv
Posts: 62
Joined: February 7th, 2017, 10:02 pm

Autohide drives when unplugged?

Post by GioRgSaVv »

Hello guys, I'm creating my own system monitoring skins and I want help with the following..

Is there any way to hide the unplugged drives? Like when I plug in a usb drive and when I unplug it it autohides the skin(or the meter only)

right now I'm this far :P
Image
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Autohide drives when unplugged?

Post by balala »

GioRgSaVv wrote:Is there any way to hide the unplugged drives? Like when I plug in a usb drive and when I unplug it it autohides the skin(or the meter only)
Yes, it is. The following code / skin hides them: https://forum.rainmeter.net/viewtopic.php?p=124353#p124353
You can adapt it to your needs.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy
Contact:

Re: Autohide drives when unplugged?

Post by fonpaolo »

You can use something similar, obviously you've to adapt for your skin:

Code: Select all

[MeasureUsedDisk_X]
Measure=Freediskspace
Drive=#Disk_X#
InvertMeasure=1
IgnoreRemovable=0
IfEqualValue=0
IfEqualAction=[!HideMeterGroup GroupDisk_X][!DisableMeasureGroup Disk_X][!UpdateMeasureGroup Disk_X][!UpdateMeterGroup GroupDisk_X][!Redraw]
IfAboveValue=0
IfAboveAction=[!ShowMeterGroup GroupDisk_X][!EnableMeasureGroup Disk_X][!UpdateMeasureGroup Disk_X][!UpdateMeterGroup GroupDisk_X][!Redraw]
Where:
- GroupDisk_X is the group of meters displaying infos, bars, and so on of the current Disk (X in this case);
- Disk_X is the group of measures related to the current Disk (X in this case).
Only add Group=GroupDisk_X to all the meters related to Disk X and Group=Disk_X to all the measures related to Disk X.
You can change the group names, it's only an example.

edit: too slow, balala beated me in the meantime I was writing...
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Autohide drives when unplugged?

Post by balala »

fonpaolo wrote:edit: too slow, balala beated me in the meantime I was writing...
Don't worry, that's happened just because I had to post just the link and didn't have to write the code. Otherwise I wouldn't beat you...
User avatar
GioRgSaVv
Posts: 62
Joined: February 7th, 2017, 10:02 pm

Re: Autohide drives when unplugged?

Post by GioRgSaVv »

after hours I finally made it work, but it doesn't show the stats of usb drive, do I need different measures for usb drive?
If I change the F to C it will show the stats of C drive, but when it's on F it doesn't show the stats of F drive(USB)
(yes it is plugged in, other skins show stats of usb)

Code: Select all

[Rainmeter]
BackgroundMode=2
SolidColor=120,120,120,1
LeftMouseUpAction=["F:\"]
Update=1000

;================================================================
;------------------------  MEASURES  ----------------------------
;================================================================

[AutoHideMeasure]
Measure=Freediskspace
Drive=F:
InvertMeasure=1
IgnoreRemovable=0
IfEqualValue=0
IfEqualAction=[!HideMeterGroup HideDrive][!DisableMeasureGroup mHideDrive]
IfAboveValue=0
IfAboveAction=[!ShowMeterGroup HideDrive][!EnableMeasureGroup mHideDrive]

[DriveLabel]
Measure=FreeDiskSpace
Drive=F:
Label=1
Group=mHideDrive

[MeasureDiskIdleTime]
Measure=Plugin
Plugin=PerfMon
PerfMonObject=LogicalDisk
PerfMonCounter="% Idle Time"
PerfMonInstance="F:"
Group=mHideDrive

[MeasureDiskTime]
Measure=Calc
Formula=(100.0 - (MeasureDiskIdleTime / 100000))
MaxValue=100.0
MinValue=0.0
Group=mHideDrive

[MeasureTotalDiskSpace]
Measure=FreeDiskSpace
Drive=F:
Total=1
UpdateDivider=1
Group=mHideDrive

[MeasureFreeDiskSpace]
Measure=FreeDiskSpace
Drive=F:
UpdateDivider=1
Group=mHideDrive

[MeasureUsedDiskSpace]
Measure=FreeDiskSpace
Drive=F:
InvertMeasure=1
UpdateDivider=1
Group=mHideDrive

;================================================================
;-------------------------  STYLES  -----------------------------
;================================================================

[FontStyle]
FontFace=No More Lies
FontSize=16
FontColor=255,255,255
StringEffect=Border
AntiAlias=1

;================================================================
;--------------------------  METERS -----------------------------
;================================================================

[F]
Meter=String
MeterStyle=FontStyle
Text=F:
Group=HideDrive

[Label]
Meter=String
MeterStyle=FontStyle
MeasureName=DriveLabel
FontColor=255,0,80
StringAlign=Left
X=R
Text=%1
Group=HideDrive

[DriveUsage]
Meter=String
MeasureName=MeasureDiskTime
MeterStyle=FontStyle
FontColor=255,0,80
Percentual=1
X=217
StringAlign=Right
Text=%1%
Group=HideDrive

[Total]
Meter=String
MeterStyle=FontStyle
FontColor=255,255,255
FontSize=10
Y=R
Text=Total:
Group=HideDrive

[DriveTotal]
Meter=String
MeasureName=MeasureTotalDiskSpace
MeterStyle=FontStyle
FontColor=255,0,80
FontSize=10
AutoScale=1
StringAlign=Right
Y=r
X=112
Text=%1B
Group=HideDrive

[DriveBar]
Meter=BAR
BarColor=0,170,255
BarOrientation=Horizontal
SolidColor=20,20,20,200
MeasureName=MeasureUsedDiskSpace
BarEffect=Border
Y=1r
X=r
W=100
H=11
Group=HideDrive

[Used]
Meter=String
MeterStyle=FontStyle
FontColor=255,255,255
FontSize=10
Y=40
Text=Used:
Group=HideDrive

[DriveUsed]
Meter=String
MeasureName=MeasureUsedDiskSpace
MeterStyle=FontStyle
FontColor=255,0,80
FontSize=10
AutoScale=1
StringAlign=Right
Y=r
X=112
Text=%1B
Group=HideDrive

[Free]
Meter=String
MeterStyle=FontStyle
FontColor=255,255,255
FontSize=10
Y=r
X=110
Text=Free:
Group=HideDrive

[DriveFree]
Meter=String
MeasureName=MeasureFreeDiskSpace
MeterStyle=FontStyle
FontColor=255,0,80
FontSize=10
AutoScale=1
StringAlign=Right
Y=r
X=215
Text=%1B
Group=HideDrive
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Autohide drives when unplugged?

Post by balala »

GioRgSaVv wrote:after hours I finally made it work, but it doesn't show the stats of usb drive, do I need different measures for usb drive?
If I change the F to C it will show the stats of C drive, but when it's on F it doesn't show the stats of F drive(USB)
Add an IgnoreRemovable=0 option to all FreeDiskSpace measures (in your code [AutoHideMeasure], [DriveLabel], [MeasureTotalDiskSpace], [MeasureFreeDiskSpace] and finally [MeasureUsedDiskSpace]). This option is added just to the [AutoHideMeasure] measure. Without adding it to all measures, they are ignoring the removable drives.
User avatar
GioRgSaVv
Posts: 62
Joined: February 7th, 2017, 10:02 pm

Re: Autohide drives when unplugged?

Post by GioRgSaVv »

aha I understand now, Thank you so much for all of your help guys!! you really helped me a lot! :)
next is cpu skin! :D
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Autohide drives when unplugged?

Post by balala »

GioRgSaVv wrote:aha I understand now, Thank you so much for all of your help guys!! you really helped me a lot! :)
From my part, I'm glad to help.
Bonsewswesa
Posts: 5
Joined: February 3rd, 2016, 10:33 am

Re: Autohide drives when unplugged?

Post by Bonsewswesa »

Sorry to latch onto someone else's thread but I have a very similar problem/goal:

I have a skin for removable drives that displays "NOT DETECTED" text if the drive is removed, however the IfCondition I've set up only reacts when I remove a drive. If I plug it back in, the rest of my skin reacts normally but for this text nothing happens and I have to refresh the skin to get it to change back.

Code: Select all

[MeasureDetectDrive]
Measure=FreeDiskSpace
Drive=#Drive3Dir#
Total=1
IgnoreRemovable=0
IfCondition=MeasureDetectDrive = 0
IfTrueAction=[!SetOption DriveText Text "NO #Drive3Dir# DRIVE DETECTED"]
IfFalseAction[!SetOption DriveText Text "#Drive3Text#  %1B - %2B"]
I've tried setting UpdateInterval = 3 and IfConditionMode = 1 (if that even helps) but with no changes. Any help is appreciated.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Autohide drives when unplugged?

Post by balala »

Bonsewswesa wrote:I have a skin for removable drives that displays "NOT DETECTED" text if the drive is removed, however the IfCondition I've set up only reacts when I remove a drive. If I plug it back in, the rest of my skin reacts normally but for this text nothing happens and I have to refresh the skin to get it to change back.
An equal sign is missing from the IfFalseAction. Its correct form would be: IfFalseAction[color=#FF0000]=[/color][!SetOption DriveText Text "#Drive3Text# %1B - %2B"], instead of the original IfFalseAction[!SetOption DriveText Text "#Drive3Text# %1B - %2B"].
Post Reply