It is currently April 20th, 2024, 4:08 pm

Null String Returned from UsageMonitor Plugin

Get help with creating, editing & fixing problems with skins
stonehdl
Posts: 2
Joined: February 24th, 2023, 6:56 am

Null String Returned from UsageMonitor Plugin

Post by stonehdl »

The UsageMonitor plugin appears to return a null string rather than the the current string value of the name
of the instance as stated in the documentation.

My RainMeter shield is:

Code: Select all

     [Rainmeter]
     Update=1000
     AccurateText=1

     [Variables]

     SkinX=1920
     SkinY=181
     TextColor=242,232,188,255

     [Measures]

     [MeasureHDD]
     Measure=Plugin
     Plugin=UsageMonitor
     Category=LogicalDisk
     Counter=% Disk Time
     Index=1
     MinValue=0
     MaxValue=100
     DynamicVariables=1

     [Meters]

     [MeterHDDName]
     Meter=String
     MeasureName=MeasureHDD
     FontFace=Ariel
     FontColor=#TextColor#
     FontSize=35
     StringAlign=Center
     DynamicVariables=1
     X=(#SkinX#+640)
     Y=(#SkinY#+500)
MeterHDDName does not print anything at all. Clearly I am doing something stupid. Can anyone help me find the error?
Last edited by SilverAzide on February 24th, 2023, 12:47 pm, edited 1 time in total.
Reason: Please use code tags when posting code. It's the </> button.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2604
Joined: March 23rd, 2015, 5:26 pm

Re: Null String Returned from UsageMonitor Plugin

Post by SilverAzide »

stonehdl wrote: February 24th, 2023, 7:09 am The UsageMonitor plugin appears to return a null string rather than the the current string value of the name
of the instance as stated in the documentation.

My RainMeter shield is:

MeterHDDName does not print anything at all. Clearly I am doing something stupid. Can anyone help me find the error?
There are a few problems and many annoyances with the code, but it works for me.

The main problem is not the UsageMonitor plugin, it is working properly. The problem is your meter displaying the value. What is the width of your screen? You've forced the text to display way to the right, beyond the borders of the typical 1920x1080 screen.

The X/Y coordinates in the skin are relative to the skin placement. The upper left corner of the skin is 0,0, no matter where it is placed on screen. By forcing the meter to display way to the right, your skin is a giant rectangle covering most (if not all) of the screen. Just display the text at 0,0 or whatever, then move the entire skin to where you want it.

Look at the Rainmeter About screen on the Skins tab to see the values of your measures and variables. If your measure is really returning nothing, then your Performance Counters database is corrupted (but easily fixed).

Finally, a tip: the "% Disk Time" counter doesn't work like you think it does. If you want to show how busy your disk is, this counter will return percentage values that go well above 100% (even though you have set the max at 100). With modern disk caching, the performance easily exceeds 100%, especially with SSDs. The proper way to report disk activity is to look at "% Idle Time" and subtract that value from 100.

FYI, the FontFace name in your code is incorrectly spelled, it should be "Arial". (Incorrectly spelled or non-existent fonts will default to Arial.)

Annoyances:
  • Don't use text like "[Meters]" and "[Measures]" as comments. The square brackets indicate the start of a section; i.e., code. If you want comments, use a semi-colon at the start of the line, like "; Meters".
  • Don't use DynamicVariables=1 everywhere. It is needed in many cases, but not in yours. It does have an impact on performance, so use this only when needed.
  • If you are indenting your entire code like in your post, please don't.
Gadgets Wiki GitHub More Gadgets...
stonehdl
Posts: 2
Joined: February 24th, 2023, 6:56 am

Re: Null String Returned from UsageMonitor Plugin

Post by stonehdl »

Thank you, SilverAzide, for taking the time to review my code. I appreciate the detailed thought you put in to it. Particularly the hint about the
Rainmeter About screen.

I'll make the changes you suggest.

As an aside, the extreme position of the text comes from my using two monitors, extended to form one display area. The information was to be placed on the right-most monitor.

Thanks again.

Dave S.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2604
Joined: March 23rd, 2015, 5:26 pm

Re: Null String Returned from UsageMonitor Plugin

Post by SilverAzide »

stonehdl wrote: February 24th, 2023, 6:48 pm As an aside, the extreme position of the text comes from my using two monitors, extended to form one display area. The information was to be placed on the right-most monitor.
OK, cool. Right-click your skin and select Settings > Position > Display monitor, and choose your monitor or enable the auto-select option.

That way you can just drag your skin onto your second monitor and it will stay there. There are a number of positioning options you can do as well if you want your skin to display relative to a monitor's edge.
Gadgets Wiki GitHub More Gadgets...