It is currently September 15th, 2019, 11:04 pm

CPU and GPU names with HWiNFO

Help with creating, editing & fixing problems with skins
LxixSxA
Posts: 6
Joined: January 15th, 2018, 1:18 am

Re: CPU and GPU names with HWiNFO

LxixSxA » January 15th, 2018, 2:57 am

jsmorley wrote:Glad to help.

i do the same things to my gpu, GPU [#0]: AMD Radeon R5/R6/R7 Series:
but the return value was /1

can you let me know where's my mistakes?
im stuck with this regex T_T
User avatar
jsmorley
Developer
Posts: 19440
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: CPU and GPU names with HWiNFO

jsmorley » January 15th, 2018, 12:03 pm

LxixSxA wrote:i do the same things to my gpu, GPU [#0]: AMD Radeon R5/R6/R7 Series:
but the return value was /1

can you let me know where's my mistakes?
im stuck with this regex T_T
You should post your code so we can see it, but I assume you accidentally used "/1" instead of "\1" in that Substitute option.
User avatar
balala
Rainmeter Sage
Posts: 8617
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: CPU and GPU names with HWiNFO

balala » January 15th, 2018, 1:17 pm

LxixSxA wrote:i do the same things to my gpu, GPU [#0]: AMD Radeon R5/R6/R7 Series:
but the return value was /1

can you let me know where's my mistakes?
im stuck with this regex T_T
I think there could be a mistake in the Substitute option. Probably you've used a slash, instead of the backslash. I think this, because you said the substitution returns /1 and this is happening in such cases.
Eg, remaining at the last posted substitution, jsmorley put there:
jsmorley wrote:

Code: Select all

RegExpSubstitute=1
Substitute="^.*: (.*)$":"\1"
but if you made a small mistake and used the Substitute option with a slash: Substitute="^.*: (.*)$":"[color=#FF0000]/[/color]1", the substitution gives /1. The correct form of the Substitute option would be: Substitute="^.*: (.*)$":"[color=#00FF00]\[/color]1".
User avatar
jsmorley
Developer
Posts: 19440
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: CPU and GPU names with HWiNFO

jsmorley » January 15th, 2018, 1:25 pm

Code: Select all

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

[MeasureString]
Measure=String
String=GPU [#0]: AMD Radeon R5/R6/R7 Series
RegExpSubstitute=1
Substitute="^.*: (.*)$":"\1"

[MeterString]
Meter=String
MeasureName=MeasureString
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
1.png
You do not have the required permissions to view the files attached to this post.
LxixSxA
Posts: 6
Joined: January 15th, 2018, 1:18 am

Re: CPU and GPU names with HWiNFO

LxixSxA » January 15th, 2018, 2:03 pm

i don't know why but dat code still give me \1 as a result

Code: Select all

[HWiNFOGPU0Name]
Measure=Plugin
Plugin=HWiNFO.dll
HWiNFOSensorId=0xe0001800
HWiNFOSensorInstance=0x0
HWiNFOType=SensorName
RegExpSubstitute=1
Substitute="^.*: (.*)$":"\1"

[meterLabelGPU0]
Meter=String
MeterStyle=styleLeftText
MeasureName=HWiNFOGPU0Name
X=10
Y=80
W=190
H=14
Text=%1
Capture.JPG
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 19440
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: CPU and GPU names with HWiNFO

jsmorley » January 15th, 2018, 2:10 pm

Use this:

Code: Select all

[HWiNFOGPU0Name]
Measure=Plugin
Plugin=HWiNFO.dll
HWiNFOSensorId=0xe0002000
HWiNFOSensorInstance=0x0
HWiNFOType=SensorName
RegExpSubstitute=1
Substitute="(?U)^.*: (.*)$":"\1"
For some reason, and it's not apparent to me right off, it is failing to resolve properly unless you make the regular expression "ungreedy" with the (?U).

Edit: I see the reason. It appears that there is a trailing ":" at the end of the string for the GPU. So when the expression is "greedy", it it finding that when you use .*:, which is "skip all characters until you see a :". So while the regular express technically "succeeds", it is returning an empty string, which the replacement routine using \1 just hates...
LxixSxA
Posts: 6
Joined: January 15th, 2018, 1:18 am

Re: CPU and GPU names with HWiNFO

LxixSxA » January 15th, 2018, 2:11 pm

aah im trying this one

Code: Select all

[HWiNFOGPU0Name]
Measure=Plugin
Plugin=HWiNFO.dll
HWiNFOSensorId=0xe0001800
HWiNFOSensorInstance=0x0
HWiNFOType=SensorName
RegExpSubstitute=1
Substitute="^(.*]: )":"","(: .*)$":""

[meterLabelGPU0]
Meter=String
MeterStyle=styleLeftText
MeasureName=HWiNFOGPU0Name
X=10
Y=80
W=190
H=14
Text=%1
and this one work perfectly
Capture.JPG
but im still confused with this regex @@
can you explain to me the different between dat code ?
ah thanks for the responses btw :thumbup:
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 19440
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: CPU and GPU names with HWiNFO

jsmorley » January 15th, 2018, 2:18 pm

Well, what you are doing with:

Substitute="^(.*]: )":"","(: .*)$":""

Is "excluding". You are saying "capture this, and remove it"

Where what I am doing with:

Substitute="(?U)^.*: (.*)$":"\1"

Is "including". I'm saying "capture this, and use only it"

The net result is really the same, although I should point out that the second part of your Substitute option is not required and has no effect. This would work fine:

Substitute="^(.*]: )":""
LxixSxA
Posts: 6
Joined: January 15th, 2018, 1:18 am

Re: CPU and GPU names with HWiNFO

LxixSxA » January 15th, 2018, 2:25 pm

jsmorley wrote:Well, what you are doing with:

Substitute="^(.*]: )":"","(: .*)$":""

Is "excluding". You are saying "capture this, and remove it"

Where what I am doing with:

Substitute="(?U)^.*: (.*)$":"\1"

Is "including". I'm saying "capture this, and use only it"

The net result is really the same, although I should point out that the second part of your Substitute option is not required and has no effect. This would work fine:

Substitute="^(.*]: )":""

thanks !!!
your explanation is very easy to understand
you're the best thanks :17good