It is currently March 29th, 2024, 11:53 am

Trouble figuring out how to hide meter on key variable change

Get help with creating, editing & fixing problems with skins
jminternelia
Posts: 65
Joined: March 21st, 2017, 3:46 am

Trouble figuring out how to hide meter on key variable change

Post by jminternelia »

Working on a drive menu that will open once a skin is clicked on. When a skin is clicked on, it will open another skin that serves as a selection screen. I want to display all hard drives (Up to, lets say 10, but that's arbitrary), but want to hide any "empty" meters that would show drives that don't exist. Not sure how to get the [MeasureDrivesVar] to read the Number of Drives variable, and disable meters based on that key variable. [MeterLabel10] and [MeterDisk10]. I know that [MeasureDriveLetter1] takes a few seconds to get the correct value, and figured the whole thing could refresh every 5 seconds, since it'll more or less be a pop-up/context menu that is opened with mouse actions. In this specific instance, I have 9 drives. I have meters for 10 drives, but the last meter isn't being disabled once the NumberOfDrives variable is updated to 9.

How it looks:
Image

How it should look:
Image

Any suggestions?

Code: Select all

[Rainmeter]
Update=5000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,1

[Variables]
NumberOfDrives=0

; == MEASURES ==========================================================

[MeasureDriveLetter1]
 Measure=Plugin
 Plugin=DriveList.dll
 DefaultString="_"
 NumberType=Count
 Index=0
 FinishAction=[!UpdateMeasureGroup "fdsGroup"][!WriteKeyValue "Variables" "NumberOfDrives" [MeasureDriveLetter1:]][!UpdateMeter *][!Redraw]
 OnChangeAction=[!Refresh]
 Group=dlGroup
 DynamicVariables=1
 
[MeasureDrivesVar]
Meter=String
Measure=Calc
Formula=#NumberOfDrives#
IfCondition=9
IfConditionAction=[!HideMeter MeterLetter10][!HideMeter MeterDisk10][!UpdateMeter *][!Redraw]
DynamicVariables=1
 
[MeasureDriveLetter2]
 Measure=Plugin
 Plugin=DriveList.dll
 Parent=MeasureDriveLetter1
 Index=1
 Group=dlGroup

[MeasureDriveLetter3]
 Measure=Plugin
 Plugin=DriveList.dll
 Parent=MeasureDriveLetter1
 Index=2
 Group=dlGroup
 
 [MeasureDriveLetter4]
 Measure=Plugin
 Plugin=DriveList.dll
 Parent=MeasureDriveLetter1
 Index=3
 Group=dlGroup
 
 [MeasureDriveLetter5]
 Measure=Plugin
 Plugin=DriveList.dll
 Parent=MeasureDriveLetter1
 Index=4
 Group=dlGroup
 
 [MeasureDriveLetter6]
 Measure=Plugin
 Plugin=DriveList.dll
 Parent=MeasureDriveLetter1
 Index=5
 Group=dlGroup
 
 [MeasureDriveLetter7]
 Measure=Plugin
 Plugin=DriveList.dll
 Parent=MeasureDriveLetter1
 Index=6
 Group=dlGroup
 
 [MeasureDriveLetter8]
 Measure=Plugin
 Plugin=DriveList.dll
 Parent=MeasureDriveLetter1
 Index=7
 Group=dlGroup
 
 [MeasureDriveLetter9]
 Measure=Plugin
 Plugin=DriveList.dll
 Parent=MeasureDriveLetter1
 Index=8
 Group=dlGroup
 
 [MeasureDriveLetter10]
 Measure=Plugin
 Plugin=DriveList.dll
 Parent=MeasureDriveLetter1
 Index=9
 Group=dlGroup

[MeasureDiskLabel1]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter1]
 Label=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup

[MeasureDiskSize1]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter1]
 Total=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup

[MeasureDiskLabel2]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter2]
 Label=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup

[MeasureDiskSize2]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter2]
 Total=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup

[MeasureDiskLabel3]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter3]
 Label=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup

[MeasureDiskSize3]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter3]
 Total=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup
 
[MeasureDiskLabel4]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter4]
 Label=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup
 
 [MeasureDiskSize4]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter4]
 Total=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup
 
 [MeasureDiskLabel5]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter5]
 Label=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup
 
 [MeasureDiskSize5]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter5]
 Total=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup
 
 [MeasureDiskLabel6]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter6]
 Label=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup
 
 [MeasureDiskSize6]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter6]
 Total=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup

[MeasureDiskLabel7]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter7]
 Label=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup
 
 [MeasureDiskSize7]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter7]
 Total=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup

[MeasureDiskLabel8]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter8]
 Label=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup
 
 [MeasureDiskSize8]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter8]
 Total=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup

[MeasureDiskLabel9]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter9]
 Label=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup
 
 [MeasureDiskSize9]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter9]
 Total=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup

[MeasureDiskLabel10]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter10]
 Label=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup
 
 [MeasureDiskSize10]
 Measure=FreeDiskSpace
 Drive=[MeasureDriveLetter10]
 Total=1
 DynamicVariables=1
 UpdateDivider=-1
 Group=fdsGroup


; == METERS ============================================================

[StyleAllString]
 AntiAlias=1
 FontFace=Segoe UI
 FontSize=12
 FontColor=250,250,250
 SolidColor=0,0,0,1
 AutoScale=1
 NumOfDecimals=0

[StyleLeft]
 StringAlign=Left
 X=5
 Y=5R
 Text=%1

[StyleRight]
 StringAlign=Right
 X=195
 Y=r
 Text=%1 (%2B)

[MeterBg]
 Meter=Image
 SolidColor=50,50,50,200
 X=0
 Y=0
 W=200
 H=115

[MeterDriveCount]
 Meter=String
 MeterStyle=StyleAllString
 NumOfDecimals=0
 X=5
 Y=5
 Text=[MeasureDriveLetter1:]
 DynamicVariables=1


[MeterLetter1]
 Meter=String
 MeterStyle=StyleAllString | StyleLeft
 MeasureName=MeasureDriveLetter1

[MeterLabel1]
 Meter=String
 MeterStyle=StyleAllString | StyleRight
 MeasureName=MeasureDiskLabel1
 MeasureName2=MeasureDiskSize1

[MeterLetter2]
 Meter=String
 MeterStyle=StyleAllString | StyleLeft
 MeasureName=MeasureDriveLetter2

[MeterLabel2]
 Meter=String
 MeterStyle=StyleAllString | StyleRight
 MeasureName=MeasureDiskLabel2
 MeasureName2=MeasureDiskSize2

[MeterLetter3]
 Meter=String
 MeterStyle=StyleAllString | StyleLeft
 MeasureName=MeasureDriveLetter3

[MeterDisk3]
 Meter=String
 MeterStyle=StyleAllString | StyleRight
 MeasureName=MeasureDiskLabel3
 MeasureName2=MeasureDiskSize3
 
 [MeterLetter4]
 Meter=String
 MeterStyle=StyleAllString | StyleLeft
 MeasureName=MeasureDriveLetter4

[MeterDisk4]
 Meter=String
 MeterStyle=StyleAllString | StyleRight
 MeasureName=MeasureDiskLabel4
 MeasureName2=MeasureDiskSize4
 
[MeterLetter5]
 Meter=String
 MeterStyle=StyleAllString | StyleLeft
 MeasureName=MeasureDriveLetter5

[MeterDisk5]
 Meter=String
 MeterStyle=StyleAllString | StyleRight
 MeasureName=MeasureDiskLabel5
 MeasureName2=MeasureDiskSize5
 
[MeterLetter6]
 Meter=String
 MeterStyle=StyleAllString | StyleLeft
 MeasureName=MeasureDriveLetter6

[MeterDisk6]
 Meter=String
 MeterStyle=StyleAllString | StyleRight
 MeasureName=MeasureDiskLabel6
 MeasureName2=MeasureDiskSize6
 
[MeterLetter7]
 Meter=String
 MeterStyle=StyleAllString | StyleLeft
 MeasureName=MeasureDriveLetter7

[MeterDisk7]
 Meter=String
 MeterStyle=StyleAllString | StyleRight
 MeasureName=MeasureDiskLabel7
 MeasureName2=MeasureDiskSize7
 
[MeterLetter8]
 Meter=String
 MeterStyle=StyleAllString | StyleLeft
 MeasureName=MeasureDriveLetter8

[MeterDisk8]
 Meter=String
 MeterStyle=StyleAllString | StyleRight
 MeasureName=MeasureDiskLabel8
 MeasureName2=MeasureDiskSize8
 
[MeterLetter9]
 Meter=String
 MeterStyle=StyleAllString | StyleLeft
 MeasureName=MeasureDriveLetter9

[MeterDisk9]
 Meter=String
 MeterStyle=StyleAllString | StyleRight
 MeasureName=MeasureDiskLabel9
 MeasureName2=MeasureDiskSize9
 
[MeterLetter10]
 Meter=String
 MeterStyle=StyleAllString | StyleLeft
 MeasureName=MeasureDriveLetter10

[MeterDisk10]
 Meter=String
 MeterStyle=StyleAllString | StyleRight
 MeasureName=MeasureDiskLabel10
 MeasureName2=MeasureDiskSize10
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Trouble figuring out how to hide meter on key variable change

Post by eclectic-tech »

Your 'IfCondition' is not testing anything; change it to test the value of your variable.

Code: Select all

[MeasureDrivesVar]
Meter=String
Measure=Calc
Formula=#NumberOfDrives#
IfCondition=(#NumberOfDrives#<=9)
IfConditionAction=[!HideMeter MeterLetter10][!HideMeter MeterDisk10][!UpdateMeter *][!Redraw]
DynamicVariables=1
Or test the value of your Calc measure

Code: Select all

[MeasureDrivesVar]
Meter=String
Measure=Calc
Formula=#NumberOfDrives#
IfCondition=(MeasureDrivesVar<=9)
IfConditionAction=[!HideMeter MeterLetter10][!HideMeter MeterDisk10][!UpdateMeter *][!Redraw]
DynamicVariables=1
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Trouble figuring out how to hide meter on key variable change

Post by Yincognito »

In addition to what eclectic-tech said, I'm not sure the DriveList plugin is of much use (unless it has other "hidden features" I don't know about), since you can pretty easily check if a drive exists by using the Total (obviously 0 if the drive doesn't exist) and Type ('Removed' if drive doesn't exist) options of FreeDiskSpace measures. It's possible that the FreeDiskSpace method is faster than using DriveList as well (though I might be wrong on this one, as I didn't test the latter since there was no need to).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trouble figuring out how to hide meter on key variable change

Post by jsmorley »

Yincognito wrote: August 22nd, 2020, 2:09 pm In addition to what eclectic-tech said, I'm not sure the DriveList plugin is of much use (unless it has other "hidden features" I don't know about), since you can pretty easily check if a drive exists by using the Total (obviously 0 if the drive doesn't exist) and Type ('Removed' if drive doesn't exist) options of FreeDiskSpace measures. It's possible that the FreeDiskSpace method is faster than using DriveList as well (though I might be wrong on this one, as I didn't test the latter since there was no need to).
I think it would be best to stick with using Type to detect the existence of drives, as CD / DVD drives will not work with the Total option. That's assuming you still have a CD / DVD drive for some reason...
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Trouble figuring out how to hide meter on key variable change

Post by Yincognito »

jsmorley wrote: August 22nd, 2020, 2:26 pm I think it would be best to stick with using Type to detect the existence of drives, as CD / DVD drives will not work with the Total option. That's assuming you still have a CD / DVD drive for some reason...
Ah, yes, saw the note in the manual. I didn't used my CD / DVD drive for ages though, having it always showing 0 for its Total, so it was easy to miss this detail. Using Total to check the existence of the CD / DVD drive would probably always detect it as non-existent, since its Total will always be 0 (due to FreeDiskSpace not supporting CD or DVD drives other than with Type and Label), correct?

P.S. I assume that setting IgnoreRemovable to 0 won't help with the above, as that option is actually more about flash drives than CD / DVD drives, although both are technically "removable".
Last edited by Yincognito on August 22nd, 2020, 2:47 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Trouble figuring out how to hide meter on key variable change

Post by jsmorley »

Yincognito wrote: August 22nd, 2020, 2:43 pm Ah, yes, saw the note in the manual. I didn't used my CD / DVD drive for ages though, having it always showing 0 for its Total, so it was easy to miss this detail. Using Total to check the existence of the CD / DVD drive would probably always detect it as non-existent, since its Total will always be 0 (due to FreeDiskSpace not supporting CD or DVD drives other than with Type and Label), correct?
Correct.