SilverAzide wrote: ↑April 16th, 2023, 10:59 pm
Getting the
InterfaceType for your drive probably isn't going to help you in this case, because -- based the issue in your original post -- it most likely will return the same thing as a fixed disk drive. (It does for me, anyway.) You need the
BusType value.
...
Notice that this code can tell you things like whether the drive is an SD card, a RAID array, etc. You can add a series of
IfMatch expressions to handle what to do with the different values.
Fantastic!
Thank you, thank you, thank you. That's exactly what I needed. Problem solved.
The reason I needed Rainmeter to detect if a disk is a USB drive is... I have 10 SATA ports (6 onboard, 4 add-in card). 9 of which permanently populated with SSD/HDD, and 1 is hot-pluggable (assigned N:). I use HWInfo plugin monitoring these drives (e.g., read/write activities, read/write rates, total read/write GB, S.M.A.R.T. info etc). Whenever a drive is plugged in the hot-pluggable port (i.e., N:), HWInfo re-assigns Device Instances. So I have a script in my skin that detects if there is a drive N: so the skin would re-assign proper Device Instances.
Code: Select all
[DriveNName]
Measure=FreeDiskSpace
Drive=N:
Label=1
UpdateDivider=5
Substitute="":"NOT CONNECTED"
IfMatch="NOT CONNECTED"
IfMatchAction=[!SetOption DriveNFreeBar ImageAlpha 0][!SetOption NTEMPMAX Text .][!SetOption NTEMP Text .][!SetOption NTempValue ImageAlpha 0][!SetOption DummyHistogramN PrimaryColor 0,0,0,0][!SetOption MeasureLowCapacityN Formula 0][!SetOption DriveNHistogram Hidden 1][!SetOption MeterLowCapacityN Text "NO DRIVE"][!HideMeter "NHeatGradient"]
IfNotMatchAction=[!SetOption DriveNFreeBar ImageAlpha 255][!SetVariable "IDSC" "0xa"][!SetVariable "IDSD" "0xb"][!SetVariable "IDSI" "0x6"][!SetVariable "IDSJ" "0x7"][!SetVariable "IDSK" "0x8"][!SetVariable "IDSL" "0x9"][!SetVariable "IDSN" "0x5"][!SetVariable "IDRWC" "0xa"][!SetVariable "IDRWD" "0xb"][!SetVariable "IDRWI" "0x6"][!SetVariable "IDRWJ" "0x7"][!SetVariable "IDRWK" "0x8"][!SetVariable "IDRWL" "0x9"][!SetVariable "IDRWN" "0x5"][!SetVariable "IDRWC" "0xa"][!SetVariable "IDRWD" "0xb"]
However, when a USB drive is connected and assigned N: by Windows, my skin re-assigns Device Instances thinking it is a fixed drive, but is instead a USB drive. HWInfo does not monitor USB drives thus does not assign a Device ID nor Device Instance, so the skin shows wrong read/writes, etc, for the wrong drives when tmy skin re-assigned Device Instances because thers is a drive N: present.
I can now use your
RunCommand script to tell Rainmeter not to re-assign the HWInfo Device Instances though there is a drive N: if it is a USB drive.
Thank you both for the help. I truly appreciate it.
10-drives.PNG
You do not have the required permissions to view the files attached to this post.