It is currently April 28th, 2024, 5:37 pm

Using HWiNFO with Rainmeter

Plugins and Addons popular with the Community
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: Using HWiNFO with Rainmeter

Post by Nookz »

maybe it doesn't work for all sensors??
def works on my end tho.
image_2023-12-11_114549046.png
You do not have the required permissions to view the files attached to this post.
RicardoTM
Posts: 269
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Using HWiNFO with Rainmeter

Post by RicardoTM »

Nookz wrote: December 11th, 2023, 4:46 pm maybe it doesn't work for all sensors??
def works on my end tho.
image_2023-12-11_114549046.png
I guess it was too late when I was trying lol. I forgot to activate dynamic variables. Now it works.

I ended up with this:

Code: Select all

[TextStyle]
StringAlign=Center
FontFace=Helvetica
StringStyle=Bold
StringEffect=Shadow
FontColor=200,200,200,255
FontEffectColor=0,0,0,255
AntiAlias=1

[SensorValue]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=SOFTWARE\HWINFO64\VSB
RegValue=Value7
RegExpSubstitute=1
Substitute="(?:\d)":"","(\.)":"","(\s)":""


[ValueText]
Meter=String
MeterStyle=TextStyle
StringAlign=Left
x=0
y=0
Text=[SensorValue:]
FontSize=75
DynamicVariables=1


[UnitText]
Meter=String
MeasureName=SensorValue
MeterStyle=TextStyle
StringAlign=Left
x=R
y=10
Text=%1
FontSize=20

Captura de pantalla 2023-12-11 170517.jpg
Thanks!

Edit:

Something weird is happening tho..

If the number gets above 1,000 it rounds it to 1. On any RPM sensor would only return 1. I tested with and without the substitution and the result is the same, I tried with [SensorValue]=Returns the Units (String Value), [SensorValue:]=Returns 1 and [SensorValue:0]=Returns 1 also. [SensorValue:1] or above returns 1.0. 1.00, etc.
Captura de pantalla 2023-12-11 173959.jpg
The problem seems to be the ",". Rainmeter thinks it's a decimal separator instead of a thousand separator I guess. If I change the thousand separator "," for a blank space in HWiNFO the problem goes away.

Telling the users to deactivate commas on HWiNFO is not that intuitive tho. Any alternative to fix the comma issue?
You do not have the required permissions to view the files attached to this post.
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: Using HWiNFO with Rainmeter

Post by Nookz »

I have a solution for you. Don't know if you're gonna like it.. :rofl:

Code: Select all

[Rainmeter]
Update=1000
OnRefreshAction=[!SetVariable Unit "[Sensor]"][!UpdateMeter Unit][!SetVariable Substitute [^0-9.]]
DynamicWindowSize=1

[Variables]
Substitute="(.*\d)"
Unit=0

[TextStyle]
FontColor=255,255,255
FontSize=12
AntiAlias=1
DynamicVariables=1
X=r
Y=2R

[Sensor]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=SOFTWARE\HWINFO64\VSB
RegValue=Value32
RegExpSubstitute=1
Substitute="#Substitute#":""
DynamicVariables=1

[Value]
Meter=String
Text="[Sensor]"
MeterStyle=TextStyle

[Unit]
Meter=String
Text="#Unit#"
MeterStyle=TextStyle
DynamicVariables=1
UpdateDivider=-1
What this does is that on refresh ( you could also set it on a measure I guess ), it will set the Unit variable, then switch the substitute to keep only the numerical values.
Then you use the variable in your unit meter and the sensor value in your value meter.

Takes one update cycle to 'initialize' the Unit variable, but you're still using only one Measure per sensor and getting both the Value and the Unit, regardless of the format the value is in AND, your unit meter wouldn't have to update every cycle as you only need to set it once.

I think this should work.
User avatar
Yincognito
Rainmeter Sage
Posts: 7179
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Using HWiNFO with Rainmeter

Post by Yincognito »

RicardoTM wrote: December 11th, 2023, 11:07 pmSomething weird is happening tho..
It's not weird, it's about registry values being strings and various localizations.

Two measures alternative:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

---Measures---

[SensorValue]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=SOFTWARE\HWINFO64\VSB
RegValue=Value3
RegExpSubstitute=1
Substitute="^(.*)\s+(.*)$":"\1","^\\\d+$":"0"

[SensorUnit]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=SOFTWARE\HWINFO64\VSB
RegValue=Value3
RegExpSubstitute=1
Substitute="^(.*)\s+(.*)$":"\2","^\\\d+$":"-"

---Styles---

[TextStyle]
StringAlign=Center
FontFace=Helvetica
StringStyle=Bold
StringEffect=Shadow
FontColor=200,200,200,255
FontEffectColor=0,0,0,255
AntiAlias=1

---Meters---

[ValueText]
Meter=String
MeterStyle=TextStyle
StringAlign=Left
x=0
y=0
Text=[SensorValue]
FontSize=75
DynamicVariables=1

[UnitText]
Meter=String
MeterStyle=TextStyle
StringAlign=Left
x=R
y=10
Text=[SensorUnit]
FontSize=20
DynamicVariables=1
One measure alternative:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

---Measures---

[Sensor]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=SOFTWARE\HWINFO64\VSB
RegValue=Value3

---Styles---

[TextStyle]
StringAlign=Center
FontFace=Helvetica
StringStyle=Bold
StringEffect=Shadow
FontColor=200,200,200,255
FontEffectColor=0,0,0,255
AntiAlias=1

---Meters---

[ValueText]
Meter=String
MeterStyle=TextStyle
StringAlign=Left
InlinePattern=^.*\s+(.*)$
InlineSetting=Size | 20
x=0
y=0
Text=[Sensor]
FontSize=75
DynamicVariables=1
Unfortunately for your layout, changing the inline font size in the one measure alternative above is done from the bottom of the text, obviously to keep stuff on the same line - which means the unit will be at the bottom and not at the top compared to the value. Trying inline typography options like superscripts could in theory adjust this even without changing the font size, but it mainly works with numbers. That being said, if one really wants superscript for the unit, there are such characters in the Phonetic Extensions block (starting with U+1D2C), but normal letters in the unit area would have to be replaced with superscript ones in a revived Substitute instead (just 26 replacements or so). :D
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
RicardoTM
Posts: 269
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Using HWiNFO with Rainmeter

Post by RicardoTM »

Nookz wrote: December 12th, 2023, 12:24 am I have a solution for you. Don't know if you're gonna like it.. :rofl:

Code: Select all

[Rainmeter]
Update=1000
OnRefreshAction=[!SetVariable Unit "[Sensor]"][!UpdateMeter Unit][!SetVariable Substitute [^0-9.]]
DynamicWindowSize=1

[Variables]
Substitute="(.*\d)"
Unit=0

[TextStyle]
FontColor=255,255,255
FontSize=12
AntiAlias=1
DynamicVariables=1
X=r
Y=2R

[Sensor]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=SOFTWARE\HWINFO64\VSB
RegValue=Value32
RegExpSubstitute=1
Substitute="#Substitute#":""
DynamicVariables=1

[Value]
Meter=String
Text="[Sensor]"
MeterStyle=TextStyle

[Unit]
Meter=String
Text="#Unit#"
MeterStyle=TextStyle
DynamicVariables=1
UpdateDivider=-1
What this does is that on refresh ( you could also set it on a measure I guess ), it will set the Unit variable, then switch the substitute to keep only the numerical values.
Then you use the variable in your unit meter and the sensor value in your value meter.

Takes one update cycle to 'initialize' the Unit variable, but you're still using only one Measure per sensor and getting both the Value and the Unit, regardless of the format the value is in AND, your unit meter wouldn't have to update every cycle as you only need to set it once.

I think this should work.
Mmmh.. I don't think I understand what you mean. I tried it just like you posted it and it returns Value=,RPM and Unit=0 I guess I need to make a button or as you said a measure that switches the variables or something.

I mean, it sounds like Unit variable should change from 0 to ",RPM" then Value meter should change from ",RPM" to the actual value right?.

I'll see what I come up with to make it work this way.


Edit:

Nvm.. I didn't see the OnRefreshAction on [Rainmeter]. Thanks, I'll see how can I implement that.
Last edited by RicardoTM on December 12th, 2023, 2:15 am, edited 1 time in total.
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: Using HWiNFO with Rainmeter

Post by Nookz »

RicardoTM wrote: December 12th, 2023, 1:52 am I tried it just like you posted it and it returns Value=,RPM and Unit=0
Maybe you didn't copy it exactly?
I'm testing it right now with a bunch of different sensors and it seems to work.
test_.rmskin
There is a 1 second delay (the update rate of the skin) when the skin start where it will show
RPM (or whatever unit)
0
but then it switches to what you want which is
the_actual_sensor_raw_value
RPM (or whatever unit)
Maybe you could hide both meters until the first update is done, if you end up using this method.

Or you can go with Yincognito method too, but that limits ( or at least complicates a lot ) how you can independently place both values
You do not have the required permissions to view the files attached to this post.
RicardoTM
Posts: 269
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Using HWiNFO with Rainmeter

Post by RicardoTM »

Nookz wrote: December 12th, 2023, 2:08 am Maybe you didn't copy it exactly?
I'm testing it right now with a bunch of different sensors and it seems to work.

test_.rmskin
There is a 1 second delay (the update rate of the skin) when the skin start where it will show
RPM (or whatever unit)
0
but then it switches to what you want which is
the_actual_sensor_raw_value
RPM (or whatever unit)
Maybe you could hide both meters until the first update is done, if you end up using this method.

Or you can go with Yincognito method too, but that limits ( or at least complicates a lot ) how you can independently place both values
Yah, I updated my post. I didn't see the [Rainmeter] OnRefreshAction lol.

Edit.

After some testing I just decided to go back to the 2 measures decision. Less headaches to deal with tbh lol.

The intended functionality is to give the user the ability to turn on/off units display. Now when the user turns on the units, the UnitsMeasure goes from disabled=1 to 0 (measure has UpdateDivider=-1) and the Units meter goes from hidden=1 to 0 as well.

So, ValueMeasure is reading ValueRaw, so it doesn't have problems with commas and I can disable decimals. UnitMeasure reads Value with substitution so it can return only the units.
ezgif.com-video-to-gif (1).gif
And my life is much easier this way :phhht :rolmfao:
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7179
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Using HWiNFO with Rainmeter

Post by Yincognito »

RicardoTM wrote: December 12th, 2023, 2:16 am After some testing I just decided to go back to the 2 measures decision. Less headaches to deal with tbh lol.
Who doesn't like 1 measure approaches? Sometimes though, it's more feasible with 2, especially when you don't have to create tons of them.

Looking at your layout, a 1 measure system would still be possible if you invert unit and value order via the substitute, add some #CRLF# between them and center the text. Hiding and showing can be replicated in the adjusted inline settings by writing the unit with a transparent color or not. Just saying, in case you badly want just 1 measure in your code. :sly:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: Using HWiNFO with Rainmeter

Post by Nookz »

Another way you could go about it is to use 1 measure and a loop to retrieve all the Unit you need and store them inside variables that you can then uses later on. Then you can have one measure per sensor using the raw value.
[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
SensorNum=34
Unit30=0
Unit31=0
Unit32=0
Unit33=0
Unit34=0

[Loop]
Measure=Loop
StartValue=30
EndValue=(#SensorNum#+1)
Increment=1
LoopCount=1
IfCondition=Loop<(#SensorNum#+1)
IfTrueAction=[!SetVariable Unit[Loop] "[SensorInput]"][!UpdateMeasure SensorInput][!UpdateMeasure Loop]
IfFalseAction=[!DisableMeasure Loop][!DisableMeasure SensorInput]
IfConditionMode=1
DynamicVariables=1
UpdateDivider=-1

[SensorInput]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=SOFTWARE\HWINFO64\VSB
RegValue=Value[Loop]
RegExpSubstitute=1
Substitute="(.*\d)":""
DynamicVariables=1
UpdateDivider=-1

[Unit]
Meter=String
MeasureName=Loop
Text="#Unit30##CRLF##Unit31##CRLF##Unit32##CRLF##Unit33##CRLF##Unit34##CRLF#"
SolidColor=0,0,0,1
FontColor=255,255,255
FontSize=12
AntiAlias=1
DynamicVariables=1
Y=2R
Just an example, but that would fetch all the sensors unit super quick, then both the loop and the sensorinput wouldn't be active anymore.
**Obviously here the Unit meter was just to test and see if it retrieved all the Unit values.

Ultimately you could also just have something like this run once as a separate skin and write the Unit variables to a units.inc file and closes itself when it's done and make it so that it never runs again unless prompted by the user (if they add or remove sensors). This way not only do you not have to have a measure for each unit meter, but you also don't have to fetch those variables every time the skin load. You can instead use the ones from the .inc file.
RicardoTM
Posts: 269
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Using HWiNFO with Rainmeter

Post by RicardoTM »

Well, I think I'll just stick to my solution this time. I don't really want a 1 measure solution that bad lol.

That loop code looks interesting, but for another use.

Thanks guys, I appreciate you help.