It is currently April 24th, 2024, 1:23 am

Registry measure and meters

Get help with creating, editing & fixing problems with skins
Werelds
Posts: 7
Joined: August 27th, 2010, 2:09 pm

Registry measure and meters

Post by Werelds »

Hey folks :)

Only just started tinkering with Rainmeter, liking it so far.

I've got a small issue now however, something that has been brought up before by someone else, but he never followed through with it after he got a reply.

First off, running 1.3 x64 r515. What I'm trying to do is to fetch some stuff from registry, as an example I'll take one from Everest. The measure and meter can be found below; the values for the RegHKey and RegKey are correct. If I use that measure with a STRING meter, it works just fine. If I try it with LINE, all I see is a flat line where the bottom of that meter should be, so the positioning is correct as well.

As I understand, Min/Max values *have* to be set for a registry key to work for these meters, so I've done that.

Code: Select all

[MeasureGPUTempCore]
Measure=Registry
RegHKey=#Everest.RegistryClass#
RegKey=#Everest.RegistryKey#
RegValue=Value.TGPU1DIOD
MinValue=0
MaxValue=90

[CoreHisto]
Meter=HISTOGRAM
MeasureName=MeasureGPUTempCore
X=0
Y=61
H=15
W=214
SolidColor=0,0,0,160
PrimaryColor=0,0,0,200

What am I missing here? Thanks in advance!
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Registry measure and meters

Post by Alex2539 »

The problem is that there are different types of data stored in the registry. If you open Regedit.exe to the location you are trying to read, you will notice the second column in the right pane is called "Type". There are several different types, but the two most common - and the two supported by Rainmeter - are REG_SZ and REG_DWORD. If the value is of type REG_SZ it means it is a string. If it is REG_DWORD it is a number. Most of Rainmeter's meter types require a number as input rather than a string. This means that if the value you are trying to read is of type REG_SZ, meters like Line, Histogram, Bar, etc. will not recognize the value. Even if the value is entirely numeric, it will still be read as a string.

You can get around this by using a Calc measure and Dynamic Variables like so:

Code: Select all

[MeasureGPUTempCore]
Measure=Registry
RegHKey=#Everest.RegistryClass#
RegKey=#Everest.RegistryKey#
RegValue=Value.TGPU1DIOD

[CalcGPUTempCore]
Measure=Calc
Formula=[MeasureGPUTempCore]
MinValue=0
MaxValue=90
DynamicVariables=1

[CoreHisto]
Meter=HISTOGRAM
MeasureName=CalcGPUTempCore
X=0
Y=61
H=15
W=214
SolidColor=0,0,0,160
PrimaryColor=0,0,0,200
This should work as long as the value being read is only numbers. If it is returning something like "54 F", you will need to substitute out the non-numeric characters.
ImageImageImageImage
Werelds
Posts: 7
Joined: August 27th, 2010, 2:09 pm

Re: Registry measure and meters

Post by Werelds »

Doh, could've figured that one out myself. Thanks a bunch for that!

Perhaps it's something to add to the manual, your explanation is crystal clear, can almost copy/paste it :p
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Registry measure and meters

Post by jsmorley »

Werelds
Posts: 7
Joined: August 27th, 2010, 2:09 pm

Re: Registry measure and meters

Post by Werelds »

Awesome, gotta love quick and direct responses like that :]

Anyway, thanks again for the explanation Alex, making some progress with my setup now :)
User avatar
abdulhakeem
Posts: 19
Joined: May 31st, 2016, 9:42 pm

Re: Registry measure and meters

Post by abdulhakeem »

Alex2539 wrote: August 27th, 2010, 9:05 pm The problem is that there are different types of data stored in the registry. If you open Regedit.exe to the location you are trying to read, you will notice the second column in the right pane is called "Type". There are several different types, but the two most common - and the two supported by Rainmeter - are REG_SZ and REG_DWORD. If the value is of type REG_SZ it means it is a string. If it is REG_DWORD it is a number. Most of Rainmeter's meter types require a number as input rather than a string. This means that if the value you are trying to read is of type REG_SZ, meters like Line, Histogram, Bar, etc. will not recognize the value. Even if the value is entirely numeric, it will still be read as a string.

You can get around this by using a Calc measure and Dynamic Variables like so:

Code: Select all

[MeasureGPUTempCore]
Measure=Registry
RegHKey=#Everest.RegistryClass#
RegKey=#Everest.RegistryKey#
RegValue=Value.TGPU1DIOD

[CalcGPUTempCore]
Measure=Calc
Formula=[MeasureGPUTempCore]
MinValue=0
MaxValue=90
DynamicVariables=1

[CoreHisto]
Meter=HISTOGRAM
MeasureName=CalcGPUTempCore
X=0
Y=61
H=15
W=214
SolidColor=0,0,0,160
PrimaryColor=0,0,0,200
This should work as long as the value being read is only numbers. If it is returning something like "54 F", you will need to substitute out the non-numeric characters.
How do you substitute out the non-numeric characters? I'm trying to get CPU Clock Speed working with a Bar meter, but the value has a comma, period, and "MHz" at the end.

EDIT: nvm figured it out, switched to "Value1Raw" instead of "Value1" and now it's working