It is currently April 20th, 2024, 11:53 am

WAN & LAN and SysInfoType/s [SOLVED]

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WAN & LAN and SysInfoType/s

Post by Yincognito »

CodeCode wrote: August 8th, 2021, 10:08 amLike what is happening when the field is empty for adapters that are not connected, and such.
If I correctly understand your question, in that case the empty (or 0) value of the field is Substitute-d with a standard "Unavailable ..." string, depending on the field.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: WAN & LAN and SysInfoType/s

Post by CodeCode »

Yincognito wrote: August 8th, 2021, 10:47 am If I correctly understand your question, in that case the empty (or 0) value of the field is Substitute-d with a standard "Unavailable ..." string, depending on the field.
Yes, that was what I didn't see straight away. But now I can see that functionality.

So, there are a couple questions that follow:
1) Wouldn't the IP be different, or blank - perhaps to say 'Inactive', rather than 'unavailable' since those revelavt adapters might be available during different usages?
2) Is it possible for some similarities in the virtual adapters, such as for mine one says 'VMware Virtual Ethernet Adapter for VMnet1'. So if the key strings are commonly similar minus specific Adapter names. What I mean by that is can the string before 'Virtual Ethernet' be escaped, so the shorter version might be available to read without an ellipsis?

Ok there are three questions:
3) I haven't tried to change anything, since your understanding is greater than mine, in terms of current functionality. The question is, can the 'Unavailable' Adapters possibly have a different color? Such a red... or blue (since red commonly infers error or similar)?

I think with some tinkering, I can get 1) and 3) but number 2) is trickier as I venture to guess some substitutions are needed. :confused:

So far this is exactly as I hoped. :thumbup:

Future options might include scrolling not only for adapter names, but in the IP range - whereby clicking would reveal the relevant adapter much like scrolling the adapters to reveal the IPs. :great:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WAN & LAN and SysInfoType/s

Post by Yincognito »

CodeCode wrote: August 8th, 2021, 12:08 pm Yes, that was what I didn't see straight away. But now I can see that functionality.

So, there are a couple questions that follow:
1) Wouldn't the IP be different, or blank - perhaps to say 'Inactive', rather than 'unavailable' since those revelavt adapters might be available during different usages?
2) Is it possible for some similarities in the virtual adapters, such as for mine one says 'VMware Virtual Ethernet Adapter for VMnet1'. So if the key strings are commonly similar minus specific Adapter names. What I mean by that is can the string before 'Virtual Ethernet' be escaped, so the shorter version might be available to read without an ellipsis?

Ok there are three questions:
3) I haven't tried to change anything, since your understanding is greater than mine, in terms of current functionality. The question is, can the 'Unavailable' Adapters possibly have a different color? Such a red... or blue (since red commonly infers error or similar)?

I think with some tinkering, I can get 1) and 3) but number 2) is trickier as I venture to guess some substitutions are needed. :confused:

So far this is exactly as I hoped. :thumbup:

Future options might include scrolling not only for adapter names, but in the IP range - whereby clicking would reveal the relevant adapter much like scrolling the adapters to reveal the IPs. :great:
1) + 2) Feel free to accordingly modify the Substitute in [MeasureAdapter] for that (it will work for everything besides the 'Total' and the 'Best' values, which are set in the !SetOption-s from the IfConditions below).
3) Add the required !SetOption-s on MeterTextAdapter in the IfMatchAction/IfNotMatchAction of [MeasureAdapter], like so:

Code: Select all

IfMatchAction=[!EnableMeasureGroup NetGroup][!EnableMeasure MeasureNICIPAddress][!SetOption MeterTextAdapter FontColor "#GlobalFontAltColor#"]
IfNotMatchAction=[!DisableMeasureGroup NetGroup][!SetOption MeasureNICIPAddress SysInfoData 999][!SetOption MeterTextAdapter FontColor "0,0,255,255"]
The match action is for available adapters, the not match action is for unavailable ones.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: WAN & LAN and SysInfoType/s

Post by CodeCode »

Awesome.
I just realised that the scroll functionality is already there :oops:

As for changing the substitute in MeasureAdapter ;
Am I incorrect to assume that 'any' or 'most' virtual adapters will actually have the string "Virtual' in them? If I am not wrong: I am not sure how to escape any or all string values before the word 'Virtual'.

Following that, I think this is actually (and verily was already) a done deal.

I have actually come up with a couple things to OCD about. It's all really cool! After I am really truly understanding all of the code you provided, I might be able to get it tweaked somehow, on my own, but I ask these things for now:

Is it possible to simply not offer for 'seeing' unavailable adapters? I do wish to be careful not to disclude adapters that can actually be monitored.

Also, I am not clear on the IP numbers. For all 'available' adapters, it is showing all the same IP. I mention this since in your original adapter tool, the IPs were different for each type. So, I mean to ask for each Type, wouldn't there be different IPs for each value? If not, I venture to speculate that in this version, the IPs are all WAN, and the IPs from your tool are LAN. Is that correct? If so, perhaps the unused left click could show the LAN IPs or the WAN IPs?

Also, one last thing for now; I am not sure about what is going on with the middle click functionality. I dont see anything on the skin, but perhaps something is happening, I just don't understand?
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WAN & LAN and SysInfoType/s

Post by Yincognito »

CodeCode wrote: August 8th, 2021, 1:14 pmAm I incorrect to assume that 'any' or 'most' virtual adapters will actually have the string "Virtual' in them? If I am not wrong: I am not sure how to escape any or all string values before the word 'Virtual'.
Yes, it's likely that they do. I can't help in removing the parts you don't need from the adapter's name if you don't provide some examples on how they look like for you and what you want them to be. I ask this because I don't know what you mean by "escape": is it "remove", or "keep" instead? :???:
CodeCode wrote: August 8th, 2021, 1:14 pmIs it possible to simply not offer for 'seeing' unavailable adapters? I do wish to be careful not to disclude adapters that can actually be monitored.
Well, that's the problem with code: this one was built based on your initial requirements, so changing the requirements in this case would meant a different approach in code (e.g. building a list of adapters, then filtering the unavailable ones out; that is problematic if those adapters change dynamically, since you'd need to update that list at that time). While in theory this would be possible, you have to decide on what you actually want: coloring the unavailable ones differently, or removing them (obviously the former is easier - and already - achieved)...
CodeCode wrote: August 8th, 2021, 1:14 pmAlso, I am not clear on the IP numbers. For all 'available' adapters, it is showing all the same IP. I mention this since in your original adapter tool, the IPs were different for each type. So, I mean to ask for each Type, wouldn't there be different IPs for each value? If not, I venture to speculate that in this version, the IPs are all WAN, and the IPs from your tool are LAN. Is that correct? If so, perhaps the unused left click could show the LAN IPs or the WAN IPs?

Also, one last thing for now; I am not sure about what is going on with the middle click functionality. I dont see anything on the skin, but perhaps something is happening, I just don't understand?
The original and this implementation are more or less the same. Seeing the same IP for some adapters can happen since it's their LAN IP, but obviously they can't ALL have the same IP. I suspect that you didn't fully understand what those clicks do:
1) middle click toggles between the adapter's name and its LAN IP
2) right click toggles between the currently shown field in 1) and the WAN IP (the latter is a single value, by the way)
I believe that what you did is not toggle back to 1) - using right click - before scrolling to a new adapter, and as a consequence what you saw was only the WAN IP (which, as I said, is a single value, not depending on the adapter). You have to familiarize yourself with how those clicks work - I had to do them this way since it was just one box where everything was shown (adapter names, their LAN IPs, plus the WAN IP).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: WAN & LAN and SysInfoType/s

Post by CodeCode »

Yincognito wrote: August 8th, 2021, 1:57 pm Yes, it's likely that they do. I can't help in removing the parts you don't need from the adapter's name if you don't provide some examples on how they look like for you and what you want them to be. I ask this because I don't know what you mean by "escape": is it "remove", or "keep" instead? :???:
The example I offer, since it actually exactly applies to me is this string: "VMware Virtual Ethernet Adapter for VMnet1"

What I meant was for everything before the word 'Virtual', be removed. Then including and after the word 'Virtual' be included, or kept.

I sort of was trying to use the correct vernacular, as in escaping a reserved character, but I was incorrect, since that would mean to Keep that reserved character rather than omit it. So from now on I will use my layman's terms so as not to confuse things any more than they are. :bow:

And everything else is totally copacetic.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2604
Joined: March 23rd, 2015, 5:26 pm

Re: WAN & LAN and SysInfoType/s

Post by SilverAzide »

CodeCode wrote: August 8th, 2021, 2:33 pm The example I offer, since it actually exactly applies to me is this string: "VMware Virtual Ethernet Adapter for VMnet1"

What I meant was for everything before the word 'Virtual', be removed. Then including and after the word 'Virtual' be included, or kept.

I sort of was trying to use the correct vernacular, as in escaping a reserved character, but I was incorrect, since that would mean to Keep that reserved character rather than omit it. So from now on I will use my layman's terms so as not to confuse things any more than they are. :bow:

And everything else is totally copacetic.
I have not been following this thread closely, so apologies if I've missed something significant.

Virtual adapters don't necessarily have "Virtual" in the name. Your particular example does, but that is just one of many many virtual adapters that exist. Your machine is going to have stuff like "Software Loopback Interface", "WAN Miniport", and similar. Look at the Rainmeter.log file and you will see the full list. The list will also indicate if it is hardware or not; but this information (unfortunately) is not available to your skin (there is no method in Rainmeter to get the virtual vs hardware value; it requires a call to Windows to query this).

However, all that aside, there is really not much point in monitoring ANY virtual network interface, including your VMware one. Why? It's because these virtual adapters (ones like for VPNs, etc.) really in the end are going to use your physical adapters anyway. For example, if you monitored your VMware or VPN adapter (assuming it is active), it's going to report the exact same data as your ethernet/wifi adapter, because the virtual one is really just kind of a "wrapper" around the real one. Any actual network activity, no matter what, is going to use a real/hardware adapter.

This is also why, if you tell Rainmeter's Net measures to report activity on ALL network interfaces, it will report values that are doubled, tripled, quadrupled what is really happening. Like copy a 10MB file over your network and Rainmeter will report 20 or 30MB were copied. This is because virtual adapters are being included, and since they are just using the physical adapters, you get double-counting and worse.
Gadgets Wiki GitHub More Gadgets...
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WAN & LAN and SysInfoType/s

Post by Yincognito »

CodeCode wrote: August 8th, 2021, 2:33 pm The example I offer, since it actually exactly applies to me is this string: "VMware Virtual Ethernet Adapter for VMnet1"
What I meant was for everything before the word 'Virtual', be removed. Then including and after the word 'Virtual' be included, or kept.
Your [MeasureAdapter] substitute should look similar to:
Substitute="(?:^\s+|\s+$)":"","^.* (?=Virtual)":"","(^$|^0$)":"Unavailable Adapter","#IPSkinVPNFullName#":"Private Internet Adapter","#IPSkinAdapterFullName#":"Standard Internet Adapter"
with the red part the key.

That being said, SilverAzide is right, those virtual adapter will have various names. A regex to exclude them would probably be incomplete either way (although one could remove the most of them if they had either 'virtual' or 'loopback' in their names). For example, I have:

Code: Select all

Bluetooth Device (Personal Area Network)
VirtualBox Host-Only Ethernet Adapter
plus others that are not "real" adapters, like:

Code: Select all

Npcap Loopback Adapter
Microsoft Wi-Fi Direct Virtual Adapter
Microsoft Wi-Fi Direct Virtual Adapter #2
So, in my case, shortening adapter names the way you do would either not remove anything, or remove too much. For my personal (and quite similar) implementation in my skins I specifically want to scroll through all adapters (and have adjustable width to fit everyone), irrespective of whether they're virtual or not, but naturally this depends on the skin author's preferences.

I guess I could make a version of your .ini where the list of adapters are retrieved through a Powershell RunCommand similar to what SilverAzide posted earlier:

Code: Select all

Get-WmiObject -Class MSFT_NetAdapter -Namespace root\StandardCimv2 | Sort-Object -Property Virtual | Format-List -Property InterfaceDescription, Virtual
then the virtual ones are filtered out in the RunCommand's Substitute, so that you only have the non-virtual ones to scroll through, but it depends on whether you actually want it and the time I have.

P.S. Even with the PS command above, I still get the Npcap Loopback Adapter as a non-virtual one, despite the fact that it's not a physical, hardware adapter, so I guess some of those "not real" adapters do slip through:
Adapters.jpg
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: WAN & LAN and SysInfoType/s

Post by CodeCode »

Sigh. Ok.
I didn't quote everyone because the explanations are rather long. So instead, having all that information, I have a new much more rational idea.

The idea is to reduce the font size depending on the length of the string - or maybe if the string reaches the clipstring length - I'm not sure which makes more sense.

Just the same, there are a couple things i can change if necessary - such as the InlineSettings for spacing and return to the default spacing. I can gain a few characters that way. Also to permanently omit the "@VPN" String (which was already done...).

I can speculate that a formula will be needed to do this idea. So I would be asking for more help on that idea, if there aren't any real roadblocks for it.

Otherwise, as I have been getting such detailed information, and the completeness of Yincognito's code, I will settle for that being the best option for function vs effort. Which in totality is some really high-grade stuff, with little or no changes even needed at all really.

:thumbup: :rosegift:

So thanks for all the help getting my ideas into working order.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: WAN & LAN and SysInfoType/s

Post by CodeCode »

CodeCode wrote: August 8th, 2021, 5:53 pm ...
The idea is to reduce the font size depending on the length of the string - or maybe if the string reaches the clipstring length - I'm not sure which makes more sense.

I can speculate that a formula will be needed to do this idea. So I would be asking for more help on that idea, if there aren't any real roadblocks for it.
...
I'm not sure if I said something that indicated there are no more questions?

If not, I am still struggling with a couple things:
1) The above quote.

2) I have not been able to find out where I can fit in a short text string before or after the IPs.

Any help on these almost last questions, is appreciated.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.