It is currently October 26th, 2021, 12:01 pm

Request help with substitution to shorten string

Help with creating, editing & fixing problems with skins
User avatar
Sh8dyDan
Posts: 19
Joined: August 22nd, 2021, 6:10 pm

Request help with substitution to shorten string

Post by Sh8dyDan »

I'm trying to show the motherboard model using HWiNFO. I have gotten as far a showing it correctly but can not figure out the substitution combination I need to use to shorten the name.

The name currently shows as:
MSI MEG Z490I UNIFY (MS-7C77) (Nuvoton NCT6687D)

I would like it to show as:
MSI MEG Z490I UNIFY

Thank you

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Metadata]

[Variables]

[Styles]

[Background]
Meter=Image
X=0
Y=0
W=326
H=58
SolidColor=40,40,40,255
UpdateDivider=-1

[Measures]

[MeasureMotherboardName]
Measure=Plugin
Plugin=HWiNFO
HWiNFOSensorId=0xf7006687
HWiNFOSensorInstance=0x0
HWiNFOType=SensorName
UpdateDivider=-1
RegExpSubstitute=1
Substitute=??????????????

[Meters]

[MeterMotherboardLabel]
Meter=String
FontSize=17
FontWeight=700
FontColor=255,165,79,255
StringAlign=Left
Y=0
UpdateDivider=-1
Text=MOTHERBOARD

[MeterMotherboardName]
Meter=String
MeasureName=MeasureMotherboardName
FontSize=12
FontColor=105,105,105,255
StringAlign=Left
FontWeight=500
Y=30
UpdateDivider=-1
Text=%1
User avatar
death.crafter
Posts: 1070
Joined: April 24th, 2021, 8:13 pm

Re: Request help with substitution to shorten string

Post by death.crafter »

Sh8dyDan wrote: August 26th, 2021, 9:47 pm I'm trying to show the motherboard model using HWiNFO. I have gotten as far a showing it correctly but can not figure out the substitution combination I need to use to shorten the name.

The name currently shows as:
MSI MEG Z490I UNIFY (MS-7C77) (Nuvoton NCT6687D)

I would like it to show as:
MSI MEG Z490I UNIFY
There is no need to make it complex using RegExpSubstitute.

Just do a simple one.

Code: Select all

Substitute=" (MS-7C77) (Nuvoton NCT6687D)" : ""
from the Realm of Death
My Current Desktop
User avatar
Judian81
Posts: 90
Joined: May 6th, 2021, 2:57 pm

Re: Request help with substitution to shorten string

Post by Judian81 »

hey hello, i am going trying to help u.

when i use your code i just get an zero. with Substitute="0" : "" you can make the zero away.

i see you are using [Styles] i think it is a little bit better if you do this ;styles. so they are used as comment. in stead of ini code.

can you point me out. i do not have hwnd HWiNFO plugin?
windows 10
User avatar
Sh8dyDan
Posts: 19
Joined: August 22nd, 2021, 6:10 pm

Re: Request help with substitution to shorten string

Post by Sh8dyDan »

The brackets appear to be causing problems.

Code: Select all

Substitute=" (MS-7C77) (Nuvoton NCT6687D)" : ""
= MSI MEG Z490I UNIFY (MS-7C77) (Nuvoton NCT6687D)

Experimenting

Code: Select all

Substitute="(MS-7C77)" : ""
= MSI MEG Z490I UNIFY () (Nuvoton NCT6687D)
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4438
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Request help with substitution to shorten string

Post by eclectic-tech »

Sh8dyDan wrote: August 26th, 2021, 11:09 pm The brackets appear to be causing problems.

Code: Select all

Substitute=" (MS-7C77) (Nuvoton NCT6687D)" : ""
= MSI MEG Z490I UNIFY (MS-7C77) (Nuvoton NCT6687D)

Experimenting

Code: Select all

Substitute="(MS-7C77)" : ""
= MSI MEG Z490I UNIFY () (Nuvoton NCT6687D)
Substitution works fine ... post your updated code that does not work for you.

I created a string measure that returns the same value as your HWiNFO measure and use Substitute... no problem.
motherboard.png

Code: Select all

; ========= Metadata ==========
[Metadata]
Name=
Author=
Information=
; BY=attribution / SA=share-alike / ND=no-derivatives / NC=non-commercial
License=CC BY-SA-NC 3.0
Version=

; ========= Variables ==========
[Variables]


; ========= Skin Settings ==========
[Rainmeter]
Update=1000
AccurateText=1

[Metadata]

[Variables]

[Styles]

[Background]
Meter=Image
X=0
Y=0
W=326
H=58
SolidColor=40,40,40,255
UpdateDivider=-1

; ========= Measures ==========
[MeasureMotherboardName]
Measure=String
String=MSI MEG Z490I UNIFY (MS-7C77) (Nuvoton NCT6687D)
Substitute=" (MS-7C77) (Nuvoton NCT6687D)" : ""
UpdateDivider=-1

; ========= Meter Styles ==========



; ========= Meters ==========
[MeterMotherboardLabel]
Meter=String
FontSize=17
FontWeight=700
FontColor=255,165,79,255
StringAlign=Left
Y=0
UpdateDivider=-1
Text=MOTHERBOARD

[MeterMotherboardName]
Meter=String
MeasureName=MeasureMotherboardName
FontSize=12
FontColor=105,105,105,255
StringAlign=Left
FontWeight=500
Y=30
UpdateDivider=-1
Text=%1
You do not have the required permissions to view the files attached to this post.
User avatar
Sh8dyDan
Posts: 19
Joined: August 22nd, 2021, 6:10 pm

Re: Request help with substitution to shorten string

Post by Sh8dyDan »

It will not work with the string pulled from HWiNFO.

Had to do this to get it to work

Code: Select all

Substitute=" (":"",")":"","MS-7C77Nuvoton NCT6687D":""
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4438
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Request help with substitution to shorten string

Post by eclectic-tech »

Sh8dyDan wrote: August 27th, 2021, 12:11 am It will not work with the string pulled from HWiNFO.

Had to do this to get it to work

Code: Select all

Substitute=" (":"",")":"","MS-7C77Nuvoton NCT6687D":""
Glad you got it working your way.

Did you remove RegExpSubstitute=1 from your code?
If you remove that line and just use death.crafter's substitute line Substitute=" (MS-7C77) (Nuvoton NCT6687D)" : "" it will also work.