It is currently March 28th, 2024, 5:08 pm

Combining Functionality FreeDisk and FileView - Limit Output To Root Dir Only?

Get help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Combining Functionality FreeDisk and FileView - Limit Output To Root Dir Only?

Post by CodeCode »

Hello. There is a recent thread here that allows browsing of all drives using the FileView Plugin.

With a bunch of tweaking, it works really nice, and I have made several change, but the basic gist remains the same.

I decided to try and get the Drive Label using a FreeDiskSpace Measure. This was achieved, but there is a behaviour I would like to limit. The limit would be for the Drive Label to only appear on the Root of all of the indexes. This is because the Drive Lable persists and still shows for every index corresponding toeach of the seven Indexes I am trying to handle.

Here is a couple snippets to show what I used to get this far - using only the first Index as a working example:

Code: Select all

;----------------------------------------------------
; Index 1
[mIndex1Name]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=FileName
Index=1
Group=Children

[mIndex1Icon]
Measure=Plugin
Plugin=FileView
Path=[mPath]
Type=Icon
IconSize=#IconSize#
Index=1
IconPath=#@#Icons\icon1.ico
Group=Children

;My added Measure
[mDrive1Label]
Measure=FreeDiskSpace
Drive=C:
Label=1
DynamicVariables=1

Code: Select all

;The string Meter for the first Index with added MeasureName
[Index1Info]
Meter=String
MeasureName=mIndex1Name
MeasureName2=mDrive1Label
MeterStyle=TextStyle | InfoStyle
w=300
clipstring=2

Code: Select all

;The modified InfoStyle Meter
[InfoStyle]
X=8R
Y=10r
Text="%1 %2"
AutoScale=1
Here is the whole Package rmskin:
CodeCodeFileFolder_CodeCode.rmskin
(177.64 KiB) Downloaded 12 times
Any help or recommendations are greatly appreciated.
:great:
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: Combining Functionality FreeDisk and FileView - Limit Output To Root Dir Only?

Post by death.crafter »

CodeCode wrote: May 25th, 2021, 11:01 am Hello. There is a recent thread here that allows browsing of all drives using the FileView Plugin.

With a bunch of tweaking, it works really nice, and I have made several change, but the basic gist remains the same.

I decided to try and get the Drive Label using a FreeDiskSpace Measure. This was achieved, but there is a behaviour I would like to limit. The limit would be for the Drive Label to only appear on the Root of all of the indexes. This is because the Drive Lable persists and still shows for every index corresponding toeach of the seven Indexes I am trying to handle.

Here is the whole Package rmskin: CodeCodeFileFolder_CodeCode.rmskin
Any help or recommendations are greatly appreciated.
:great:
Here is an work around:

Code: Select all

[mDrive1Label]
Measure=FreeDiskSpace
Drive=C:
Label=1
DynamicVariables=1
Group=DriveLabel
RegExpSubstitute=1

[mDrive1String]
Measure=String
String=[mDrive1Label]

Code: Select all

[mPath]
Measure=Plugin
Plugin=FileView
Path=""
Substitute="":"This PC"
Count=7
ShowDotDot=0
ShowHidden=1
SortType=Type
IfMatch="This PC"
IfMatchAction=[!SetVariable mPathBool 0][!SetOption mDrive1String String """[mDrive1Label]"""]
IfNotMatchAction=[!SetVariable mPathBool 1][!SetOption mDrive1String String ""]
IFMatchMode=1
OnChangeAction=[!UpdateMeterGroup Info][!Redraw]

Code: Select all

[Index1Info]
Meter=String
MeasureName=mIndex1Name
MeasureName2=mDrive1String
w=300
MeterStyle=InfoStyle | TextStyle
clipstring=2
Reply if you don't get something. :D
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Combining Functionality FreeDisk and FileView - Limit Output To Root Dir Only?

Post by CodeCode »

death.crafter wrote: May 25th, 2021, 12:51 pm Here is an work around:

Code: Select all

[mDrive1Label]
Measure=FreeDiskSpace
Drive=C:
Label=1
DynamicVariables=1
Group=DriveLabel
RegExpSubstitute=1

[mDrive1String]
Measure=String
String=[mDrive1Label]

Code: Select all

[mPath]
Measure=Plugin
Plugin=FileView
Path=""
Substitute="":"This PC"
Count=7
ShowDotDot=0
ShowHidden=1
SortType=Type
IfMatch="This PC"
IfMatchAction=[!SetVariable mPathBool 0][!SetOption mDrive1String String """[mDrive1Label]"""]
IfNotMatchAction=[!SetVariable mPathBool 1][!SetOption mDrive1String String ""]
IFMatchMode=1
OnChangeAction=[!UpdateMeterGroup Info][!Redraw]

Code: Select all

[Index1Info]
Meter=String
MeasureName=mIndex1Name
MeasureName2=mDrive1String
w=300
MeterStyle=InfoStyle | TextStyle
clipstring=2
Reply if you don't get something. :D
death.crafter - you ah mahvelous! (do you get the reference?)

Works like a charm.

I knew an IfMatch was going to be the way to go, and I also thought to the effect of an additional Measure or Meter. The String Measure is the key that allows the IfMatch to do its thing.

Sometimes I am just truely humbled by forumites' skillz. I love coding and I really should brush up on other languages like C++ and C#. Breaking down your code for this skin as a whole is really interesting, and the use of the Bool simulacrum was pretty cool to see in Rainmeter script.

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

Re: Combining Functionality FreeDisk and FileView - Limit Output To Root Dir Only?

Post by balala »

I don't contest death.crafter's solution is a good one, however it definitely has a few disadvantages.
First it introduces new String measures ([mDrive1String], but further such measures will have to be added, probably). It can be done even with no such additional measures.
Secondly I'd recommend to modify the already existing String meter(s), to get them using the drive label when needed and not use them when it's not needed.
Thirdly, death.crafter's solution sets the appropriate form of the returned info only for the first item of the list, the topmost. But there are further elements in this list (totally 7), from which, excluding the first which is properly set, the others still should show the label of the appropriate drive as well. But this is not happening, because:
  • The [mDrive2Label], [mDrive3Label] (and so on) measures are not even added to the code, so I suggest you to add them. They should have similar form as the [mDrive1Label] measure.
  • The MeasureName2 options are not added to the [Index2Info], [Index3Info] (and so on) meters.
Accordingly to the above, when applying the Text="%1 %2" option set into the [InfoStyle] section of the @Resources\MeterStyles.inc file, you get a %2 element on all lines of the skin, starting from line 2.
And one more: the mPathBool variable, set into the IfMatchAction and IfNotMatchAction options of the [mPath] measure seems useless: it is never used, so I'm not sure why has it been set.
To fix all the above things, I'd start from the original code, would modify the code of the [mPath] measure in the following way and would add the following measures to the @Resources\FileView.inc file:

Code: Select all

[mPath]
Measure=Plugin
Plugin=FileView
Path=""
Substitute="":"This PC"
Count=7
ShowDotDot=0
ShowHidden=1
SortType=Type
IfMatch="This PC"
IfMatchAction=[!SetOptionGroup Popup Text "%1 %2"][!UpdateMeterGroup "Popup"][!Redraw]
IfNotMatchAction=[!SetOptionGroup Popup Text "%1"][!UpdateMeterGroup "Popup"][!Redraw]
OnChangeAction=[!UpdateMeasure MeasureBackHeight]
FinishAction=[!Update]

[mDrive2Label]
Measure=FreeDiskSpace
Drive=D:
Label=1

[mDrive3Label]
Measure=FreeDiskSpace
Drive=E:
Label=1
DynamicVariables=1

[mDrive4Label]
Measure=FreeDiskSpace
Drive=F:
Label=1

[mDrive5Label]
Measure=FreeDiskSpace
Drive=G:
Label=1

[mDrive6Label]
Measure=FreeDiskSpace
Drive=H:
Label=1

[mDrive7Label]
Measure=FreeDiskSpace
Drive=I:
Label=1
Also add the following options to the [Index2Info] - [Index7Info] meters of the @Resources\FileMeters.inc file:

Code: Select all

[Index2Info]
...
MeasureName2=mDrive2Label
...

[Index3Info]
...
MeasureName2=mDrive3Label
...

[Index4Info]
...
MeasureName2=mDrive4Label
...

[Index5Info]
...
MeasureName2=mDrive5Label
...

[Index6Info]
...
MeasureName2=mDrive6Label
...

[Index7Info]
...
MeasureName2=mDrive7Label
...
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Combining Functionality FreeDisk and FileView - Limit Output To Root Dir Only?

Post by CodeCode »

balala wrote: May 25th, 2021, 4:30 pm I don't contest death.crafter's solution is a good one, however it definitely has a few disadvantages.
First it introduces new String measures ([mDrive1String], but further such measures will have to be added, probably). It can be done even with no such additional measures.
Secondly I'd recommend to modify the already existing String meter(s), to get them using the drive label when needed and not use them when it's not needed.
Thirdly, death.crafter's solution sets the appropriate form of the returned info only for the first item of the list, the topmost. But there are further elements in this list (totally 7), from which, excluding the first which is properly set, the others still should show the label of the appropriate drive as well. But this is not happening, because:
  • The [mDrive2Label], [mDrive3Label] (and so on) measures are not even added to the code, so I suggest you to add them. They should have similar form as the [mDrive1Label] measure.
  • The MeasureName2 options are not added to the [Index2Info], [Index3Info] (and so on) meters.
Accordingly to the above, when applying the Text="%1 %2" option set into the [InfoStyle] section of the @Resources\MeterStyles.inc file, you get a %2 element on all lines of the skin, starting from line 2.
Ah yes, I did take care of those things. The example was only needed once to make it clear what needed to be done for the rest.
And one more: the mPathBool variable, set into the IfMatchAction and IfNotMatchAction options of the [mPath] measure seems useless: it is never used, so I'm not sure why has it been set.
To fix all the above things, I'd start from the original code, would modify the code of the [mPath] measure in the following way and would add the following measures to the @Resources\FileView.inc file:
Thanks balala. I will see about incorporating your changes.
Cheers.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Combining Functionality FreeDisk and FileView - Limit Output To Root Dir Only?

Post by balala »

CodeCode wrote: May 25th, 2021, 5:46 pm Ah yes, I did take care of those things. The example was only needed once to make it clear what needed to be done for the rest.
Working with groups (in this case group of meters) makes things much easier. You don't have to take care about the rest, all meters included into the group will work similarly.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: Combining Functionality FreeDisk and FileView - Limit Output To Root Dir Only?

Post by death.crafter »

balala wrote: May 25th, 2021, 4:30 pm I don't contest death.crafter's solution is a good one, however it definitely has a few disadvantages.
First it introduces new String measures ([mDrive1String], but further such measures will have to be added, probably). It can be done even with no such additional measures.
Secondly I'd recommend to modify the already existing String meter(s), to get them using the drive label when needed and not use them when it's not needed.
Thirdly, death.crafter's solution sets the appropriate form of the returned info only for the first item of the list, the topmost. But there are further elements in this list (totally 7), from which, excluding the first which is properly set, the others still should show the label of the appropriate drive as well. But this is not happening, because:
  • The [mDrive2Label], [mDrive3Label] (and so on) measures are not even added to the code, so I suggest you to add them. They should have similar form as the [mDrive1Label] measure.
  • The MeasureName2 options are not added to the [Index2Info], [Index3Info] (and so on) meters.
Accordingly to the above, when applying the Text="%1 %2" option set into the [InfoStyle] section of the @Resources\MeterStyles.inc file, you get a %2 element on all lines of the skin, starting from line 2.
And one more: the mPathBool variable, set into the IfMatchAction and IfNotMatchAction options of the [mPath] measure seems useless: it is never used, so I'm not sure why has it been set.
To fix all the above things, I'd start from the original code, would modify the code of the [mPath] measure in the following way and would add the following measures to the @Resources\FileView.inc file:
Ahh I see. The SetOptionGroup bang was where I was thrown off. I tried to use Text="%1 %2" in FileInfo meterstyle and SetOption bang. And that didn't work most probably because a MeterStyle is not a valid section. This shouldn't be the case though. If it's defined under a section it should be changeable with SetOption. Or am I wrong?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Combining Functionality FreeDisk and FileView - Limit Output To Root Dir Only?

Post by balala »

death.crafter wrote: May 25th, 2021, 6:46 pm And that didn't work most probably because a MeterStyle is not a valid section. This shouldn't be the case though. If it's defined under a section it should be changeable with SetOption. Or am I wrong?
Yes, in fact you are. It is changeable, as you can see in the above case. The Text="%1 %2" option is defined into the [InfoStyle] section (which is a meter style section) in the @Resources\MeterStyles.inc file and used in the [Index1Info], [Index2Info] and so on. However it had been altered with !SetOption / !SetOptionGroup bangs.
When a style section is used, the options posted into this style section are used by the appropriate meters exactly like they would be posted directly into the meter itself.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Combining Functionality FreeDisk and FileView - Limit Output To Root Dir Only?

Post by balala »

CodeCode wrote: May 25th, 2021, 11:01 am Here is a couple snippets to show what I used to get this far - using only the first Index as a working example:
Additional note related to the posted code: there is no need to use quotes around the value of any option, here around the value of the Text option. The Text="%1 %2" is treated exactly like Text=%1 %2. Rainmeter in fact ignores the quotations in such cases.
An interesting fact (me at least found it extremely interesting when realized): a Substitute="a":"b" option can be used as Substitute=a":"b and perfectly works. A few details here.
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Combining Functionality FreeDisk and FileView - Limit Output To Root Dir Only?

Post by CodeCode »

Thanks so much guys.
I noticed the real OCD anomaly, when the Drive folders were opened, for abrief moment the Drive Labels would persist in the subdirectiry then dissapear, not bad perse, but OCD reasons.
So balala's solution removed that anomaly, not sure exactly how that works, since both versions were being identified in the mPath section for handling the Drive Labels.
There was an issue, in how my version was being managed and the text at the top, the Path String, Folder String, File Count String, and current Size of a file, were all coming up with %1 %2 rather t han the proper strings (this is in balala's version).
What I did was to make those string meters and parent Measures a new group: PopupB, then showing and hiding as per the general behavior of this skin, to become a hover Image(icon?) all by itself.
So, I am very happy on how that all panned out with both balala and death.dealer helping, this skin is really tidy and simply pretty, IMO.

Thanks again!
File Folder_3.0.rmskin
(178.79 KiB) Downloaded 6 times
Last edited by CodeCode on May 26th, 2021, 1:25 pm, edited 1 time in total.
Post Reply