It is currently March 29th, 2024, 7:36 am

Rainmeter 4.5.2 Having issues with NetIn NetOut after update

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

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by Sh8dyDan »

SilverAzide wrote: September 16th, 2021, 2:55 am Also, you have a logic flaw in your PowerShell commands. Your code to grab the adapter name grabs all adapters of a particular type, sorts them by name, then grabs the first one in the list. Your code to grab the adapter index grabs all adapters of a particular type, sorts them by index, then grabs the first. That can easily cause the adapter with a particular name to be mismatched with its index if you have more than one adapter of a particular type. For better results, you should sort the lists using the same order; for even better results, you should use a single PS command to grab both values along with a WebParser to parse them so you don't need two commands; and for the best results of all, ditch the whole index thing and just use names.
:)
Thanks for the tips. I easily fixed the logic flaw you pointed out. I'm currently, as a matter of exercise, trying to work through your suggestion about using WebParser. I, unfortunately, do not have any idea of how to accomplish this.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by SilverAzide »

Sh8dyDan wrote: September 16th, 2021, 11:21 pm Thanks for the tips. I easily fixed the logic flaw you pointed out. I'm currently, as a matter of exercise, trying to work through your suggestion about using WebParser. I, unfortunately, do not have any idea of how to accomplish this.
Well, assuming you just want to experiment and you don't actually want to use that interface index ( :vomit: ), there's a couple of ways you can attack this.

At first I thought of using WebParser, but you'd need at least two measures to get the data you want (index and name), but there's a simpler way that also uses two measures and it's simpler to understand, so I'll do that instead. So, just use two string measures and a regex substitution.

First, add a CommandMeasure similar to your others, but change the Powershell command to this:

Code: Select all

Get-WmiObject -Class MSFT_NetAdapter -Filter 'InterfaceType = 6 and Virtual = False' -Namespace root\StandardCimv2 | Sort-Object -Property InterfaceDescription | Select-Object InterfaceIndex,InterfaceDescription | Format-Table -HideTableHeaders
(This is the command inside the quotes, after the -Command switch.) This will output the index and name of the first ethernet adapter, and nothing else. The command measure's text value should look something like this:
___________9 Killer E2400 Gigabit Ethernet Controller

So, a bunch of spaces, a number (interface index), a space, and your adapter name.

Next, you'd create a couple of string measures. The string value is the CommandMeasure text.

Code: Select all

[MeasureInterfaceIndex]
Measure=String
String=[MeasureCommand]
RegExpSubstitute=1
Substitute="\s+(\d+).*":"\1"
DynamicVariables=1

[MeasureInterfaceName]
Measure=String
String=[MeasureCommand]
RegExpSubstitute=1
Substitute="\s+\d+\s(.*)":"\1", ... you might need extra substitutes here to chop off trailing CRLFs...
DynamicVariables=1
These will parse your CommandMeasure output, and has the advantage of a single command measure call to get two values. As a weird quirk that might be useful, you might notice that the number value of the [MeasureInterfaceName] is the interface index, while the string value is the name (this is a consequence of how Rainmeter attempts to determine number values). So you could condense this into a single measure.

I didn't try this, so you might need to tweak things.
Gadgets Wiki GitHub More Gadgets...
User avatar
Sh8dyDan
Posts: 19
Joined: August 22nd, 2021, 6:10 pm

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by Sh8dyDan »

SilverAzide wrote: September 17th, 2021, 2:03 am These will parse your CommandMeasure output, and has the advantage of a single command measure call to get two values. As a weird quirk that might be useful, you might notice that the number value of the [MeasureInterfaceName] is the interface index, while the string value is the name (this is a consequence of how Rainmeter attempts to determine number values). So you could condense this into a single measure.

I didn't try this, so you might need to tweak things.
Thank you, this worked as well. I also tried your third suggestion of just using the InterfaceDescription and I believe this is the best option.

With the latest update they made SysInfo Plugin a Measure.

Should I convert my skins now? Will this break my skin if someone were to use an older version of Rainmeter?

Old
[MeasureSysInfo]
Measure=Plugin
Plugin=SysInfo

New

[MeasureSysInfo]
Measure=SysInfo
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by SilverAzide »

Sh8dyDan wrote: September 17th, 2021, 9:32 am Should I convert my skins now? Will this break my skin if someone were to use an older version of Rainmeter?
Yes, it would break the skin if someone used an old version in theory, but don't forget that when you create an .rmskin, you tell it the minimum version of Rainmeter your skin will accept. So just set it to the current version and you are good to go.
Gadgets Wiki GitHub More Gadgets...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rainmeter 4.5.2 Having issues with NetIn NetOut after update

Post by jsmorley »

SilverAzide wrote: September 17th, 2021, 11:51 am Yes, it would break the skin if someone used an old version in theory, but don't forget that when you create an .rmskin, you tell it the minimum version of Rainmeter your skin will accept. So just set it to the current version and you are good to go.
Yes, and given the new "auto update" functionality, I'm not sure I see a reason not to just set all .rmskins to require the latest version of Rainmeter.