It is currently February 19th, 2020, 11:43 am

DriveList 2.0

Share and get help with Plugins and Addons
jeffhobson
Posts: 40
Joined: January 15th, 2015, 9:05 am

Re: DriveList 2.0

Post by jeffhobson »

I have downloaded the sample and have it working. I see in the documentation that it returns the 'Drive Letter'; when I run the sample script, it shows the disk label not the letter. I have 5 NAS drives that it does not find as well as not finding the removable disks. The count comes back as 9 which is the number of internal hard disks on the machine. I have the options for network and removable disks turned on in the script.

Thanks for the plugin, it will be a good addition to my scripts.
Don't lose heart, someone may want it and not waste time with a messy search
FlyingHyrax
Posts: 251
Joined: July 1st, 2011, 1:32 am
Location: US

Re: DriveList 2.0

Post by FlyingHyrax »

fred_gaou wrote:Hi, I don't know if it's a bug or if it's by designed but the count of drives returned by the parent measure is always 0 the first time the measure operate. It returns the actual number of drives only after the parent measure run again either after the updatedivider specified in the measure or by a manual bang such as

Code: Select all

LeftMouseUpAction=[!UpdateMeasure "parentMeasure"]
It doesn't seem logical to me. Could you explain this, please?
Apologies that this reply is late enough to be pretty well useless; I haven't been keeping up on the forums recently.

It was not by design, and I think I will call it a bug. I haven't worked on this project in a long time, but after looking over my code again I think I have an explanation of sorts. It is a little technical, having to do with how the plugin API works. A plugin measure's String value and Number value are returned from different methods in the plugin code.

The string value comes from "GetString", which Rainmeter may call "on demand". In the case of the example skin, I think it is called when the FreeDiskSpace measures are updated, so that the Measure Variable controlling Drive setting gets the most recent value.

The numeric value is returned by from the Update() method, which is always called once per update cycle. So there is no way for a measures numeric value to be updated more than once per update cycle.

So I think it is happening something like this:
  1. On the very first update cycle, the measure starts counting the drives but immediately returns zero before the counting is finished; this happens because the counting is happening in a background thread, which is required so that the plugin does not hang Rainmeter if the counting takes a long time.
  2. In between cycles, counting finishes and the FinishAction fires. The FreeDiskSpace measures are all updated, and they get the correct string values for the DriveList measures through GetString, using Dynamic Measure Variables.
  3. On the next update tick, the measure returns the count from the current list of drives and starts updating the list.
By this logic, all the numeric values (either status or count) will always be one update cycle behind. This is very unfortunate, and I'm not sure how to work around it. It might require a major redesign, or maybe there is a clever way to handle the problem in the skin instead of in the plugin... (or it might not be possible at all, since I'm not sure if there is a way to force Rainmeter to ask my plugin for a new numeric value from inside my plugin code...)
Flying Hyrax on DeviantArt
FlyingHyrax
Posts: 251
Joined: July 1st, 2011, 1:32 am
Location: US

Re: DriveList 2.0

Post by FlyingHyrax »

jeffhobson wrote:I have downloaded the sample and have it working. I see in the documentation that it returns the 'Drive Letter'; when I run the sample script, it shows the disk label not the letter.
Sorry about the very tardy reply; I haven't been keeping up with the forums at all lately. :(

That's the specific sample skin. The plugin measures are returning drive letters as their string values; these in turn are used in FreeDiskSpace measures to, in the case of the sample, show the disk label and free space. You can use additional measures to get more disk information or display the drive letters themselves using DynamicVariables in a string meter.
jeffhobson wrote: I have 5 NAS drives that it does not find as well as not finding the removable disks. The count comes back as 9 which is the number of internal hard disks on the machine. I have the options for network and removable disks turned on in the script.
Keep in mind that the sample skin is not written to dynamically display all the drives the plugin finds, only the first three... but the count should be accurate, so I'm not sure why it wouldn't be finding your removable and network drives. Those are actually turned on by default - it shouldn't even need the "Removable" and "Network" options unless you want to exclude those types. If it shows up with a drive letter under "My Computer" (or "This Computer", or whatever they're calling it in Windows 8+ these days...) the measure should find it. I haven't had any trouble with USB drives or mapped network drives myself, so this might be kind of hard to debug.
Flying Hyrax on DeviantArt
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: DriveList 2.0

Post by StArL0rd84 »

index - the measure will return the drive letter at this position in the list. (First position is 0.)
Is it possible to make start the count at 1 in stead of 0?

1 = C:/

2 = D:/

3 = E:/

4 = F:/

And how do i use the NumberType=Count?

This returns a blank value:

Code: Select all

[TotalDrives]
 Measure=Plugin
 Plugin=DriveList.dll
 NumberType=Count
 UpdateDivider=5
 DynamicVariables=1
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3759
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: DriveList 2.0

Post by eclectic-tech »

StArL0rd84 wrote:Is it possible to make start the count at 1 in stead of 0?

1 = C:/

2 = D:/

3 = E:/

4 = F:/
No, the plugin indexes start at zero.
StArL0rd84 wrote:And how do i use the NumberType=Count?

This returns a blank value:

Code: Select all

[TotalDrives]
 Measure=Plugin
 Plugin=DriveList.dll
 NumberType=Count
 UpdateDivider=5
 DynamicVariables=1
Where does it return 'blank'? It does take 5 updates before this appears...
Did you create a meter to display [TotalDrives:]?

Code: Select all

[MeterDriveCount]
 Meter=String
 NumOfDecimals=0
 X=5
 Y=5
 Text="Count: [TotalDrives:]"
 DynamicVariables=1
Works here...
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: DriveList 2.0

Post by StArL0rd84 »

eclectic-tech wrote: Works here...
Nevermind
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3759
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: DriveList 2.0

Post by eclectic-tech »

This is an example of why it would help troubleshooting if both the STRING and NUMBER values were shown in the log. :x

With your measure, the log will not show any value, it is 'blank' because the STRING value is empty, but the measure does return a NUMBER value of '2'. That's why you need to use a section variable [TotalDrives:] in the meter to see it.

The only way to see something about this measure in the log is to add INDEX=0 to the measure; then it will return the drive letter in the log 'C:'.

Hope you get this working.
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: DriveList 2.0

Post by StArL0rd84 »

I forgot a colon in my meter that's why it was blank.
ty
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: DriveList 2.0

Post by StArL0rd84 »

This plugin is freakin' awesome man.

Made a skin that requires absolutely no input from the user.
It supports up to 10 drives and i might add a few more.
Made 10 different ini files, and whenever a drive is disconnected or reconnected the skin adapts.
And because the @include function cannot be dynamic i had to get creative with some measures.
A week later i think i finally landed on a solution.
hdds.gif
The skin auto switches between the ini files like this:

Code: Select all

[Variables]
 NumberOfDrives=7

[TotalDrives1]
 Measure=Plugin
 Plugin=DriveList.dll
 NumberType=Count
 DynamicVariables=1

[TotalDrives2]
 Measure=calc
 Formula=TotalDrives1
 Substitute="0":"#NumberOfDrives#"
 DynamicVariables=1
 OnChangeAction=[!SetVariable NumberOfDrives [TotalDrives2]][!WriteKeyValue Variables NumberOfDrives "([TotalDrives2])"][!UpdateMeter *][!Redraw]

[NumberOfDrives]
 Measure=calc
 Formula=#NumberOfDrives#
 DynamicVariables=1
 OnChangeAction=[!Refresh]

 @include1=#SKINSPATH#SKINNAME\HDDs\Configurations\#NumberOfDrives#.ini
I hope this helps someone.
You do not have the required permissions to view the files attached to this post.
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))
User avatar
fred_gaou
Posts: 60
Joined: July 30th, 2014, 1:00 am

[BUG] Crashes rainmeter since one of last MS update

Post by fred_gaou »

If it has suddenly started to crash rainmeter since june MS update, see and vote for this issue on GitHub.

I will miss it if it is not updated to fix this.
  • Rainmeter 4.2.0 beta r3104 64-bit (Jun 23 2018) - French (1036)
  • Windows 10 Pro 1607 64-bit (build 14393) - French (1036)
  • Path: D:\Programmes\Customisation\Rainmeter\
  • SkinPath: D:\Programmes\Customisation\Rainmeter\Skins\
  • SettingsPath: D:\Programmes\Customisation\Rainmeter\
  • IniFile: D:\Programmes\Customisation\Rainmeter\Rainmeter.ini