Page 2 of 2
Re: CPU and GPU names with HWiNFO
Posted: January 15th, 2018, 2:57 am
by LxixSxA
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
Re: CPU and GPU names with HWiNFO
Posted: January 15th, 2018, 12:03 pm
by jsmorley
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.
Re: CPU and GPU names with HWiNFO
Posted: January 15th, 2018, 1:17 pm
by balala
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".
Re: CPU and GPU names with HWiNFO
Posted: January 15th, 2018, 1:25 pm
by jsmorley
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
Re: CPU and GPU names with HWiNFO
Posted: January 15th, 2018, 2:03 pm
by LxixSxA
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
Re: CPU and GPU names with HWiNFO
Posted: January 15th, 2018, 2:10 pm
by jsmorley
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...
Re: CPU and GPU names with HWiNFO
Posted: January 15th, 2018, 2:11 pm
by LxixSxA
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
Re: CPU and GPU names with HWiNFO
Posted: January 15th, 2018, 2:18 pm
by jsmorley
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="^(.*]: )":""
Re: CPU and GPU names with HWiNFO
Posted: January 15th, 2018, 2:25 pm
by LxixSxA
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