It is currently April 30th, 2024, 4:38 pm

WAN & LAN and SysInfoType/s [SOLVED]

Get help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: WAN & LAN and SysInfoType/s

Post by CodeCode »

Yincognito wrote: August 7th, 2021, 9:54 pm There are some minor side effects like momentarily having the max speed when dynamically changing the adapter related options in the Net measures or the fact that the graph is moving to the left when scrolling, but the former happens to me too in my skins so can't "fix" it and the latter is probably an effect of updating measures/meters that you should be able to deal with if necessary.

P.S. Because of the particularities of your skin, the implementation couldn't be as simple as my basic sample, but then, it's not complicated either and the changes are limited to the target measures/meters. If you don't understand something, just ask. ;-)
I was wondering about these couple quirks. You fixed the one (as per below quote), but the other - the getting max values for netin and netout. I acknowledge that it cant be avoided, but I noticed that a refresh allows things to settle. The max value seems to be triggered when the standard or VPN adapters are scrolled into - but not the others. I also note that when the value is scrolling down it does not max the values but when scrolling up in value the max jumps up.

What I was wondering, was if there is a way to initiate a refresh or a !ResetStats bang, if so I am a bit lost on where to put the "clearing" bang.
Yincognito wrote: August 9th, 2021, 5:37 pm By the way, if you want to start with a certain adapter, you can change the value of the NICIDDefault variable in [Variables]: -2 is the total for all adapters, -1 is the "best" adapter, and from 0 onwards they just follow the order of the SysInfoData option. You can also adjust the upper value of the Clamp() in MeterContainer's scroll actions, if you want more or less scrollable adapters (I let that at 20 as in the simpler sample in the other thread just in case, but I use 9 for my system since I don't have more than that) - which reminds me I should have set that value as a variable so it can easily be modified in your "settings" skin and such, but I reckon you know how to do it. Oh, and forgot to mention earlier, but I corrected the line / histogram jumping to the left when scrolling in the initial version, as it was just a matter of updating only the needed meters and not all of them like before.
Yes, those options weren't too tough to find, as your code is really succinct. I like the "9" for the clamp as well, and I set the NICIDDefault to 4, which is my VPN adapter.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7185
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WAN & LAN and SysInfoType/s

Post by Yincognito »

CodeCode wrote: August 10th, 2021, 3:41 am I was wondering about these couple quirks. You fixed the one (as per below quote), but the other - the getting max values for netin and netout. I acknowledge that it cant be avoided, but I noticed that a refresh allows things to settle. The max value seems to be triggered when the standard or VPN adapters are scrolled into - but not the others. I also note that when the value is scrolling down it does not max the values but when scrolling up in value the max jumps up.

What I was wondering, was if there is a way to initiate a refresh or a !ResetStats bang, if so I am a bit lost on where to put the "clearing" bang.
Yeah, unfortunately that doesn't work. You can use the simpleton version of it for clearer and better testing of the issue, instead of your more massive skin:

Code: Select all

[Variables]
NICID=0

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

---Measures---

[measureAdapterName]
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_DESCRIPTION
SysInfoData=#NICID#
RegExpSubstitute=1
Substitute="(^$|^0$)":"Unavailable"
IfMatch=^.{2,}$
IfMatchAction=[!SetOption measureIP SysInfoData "[measureAdapterName]"]
IfNotMatchAction=[!SetOption measureIP SysInfoData 999]
IfMatchMode=1
DynamicVariables=1

[measureIP]
Measure=Plugin
Plugin=SysInfo
Group=SysInfo
SysInfoType=IP_ADDRESS
SysInfoData=
RegExpSubstitute=1
Substitute="(^$|^0$)":"Unavailable"
DynamicVariables=1

[measureNetIn]
Group=NetGroup
Measure=NetIn
Interface=[measureAdapterName]
;Interface=#NICID#
;Interface=4
DynamicVariables=1

[measureNetOut]
Group=NetGroup
Measure=NetOut
Interface=[measureAdapterName]
;Interface=#NICID#
;Interface=4
DynamicVariables=1

---Meters---

[meterNICInfo]
Meter=String
StringEffect=Shadow
FontEffectColor=0,0,0,50
SolidColor=47,47,47,255
FontColor=255,255,255,255
FontFace=Consolas
FontSize=16
AntiAlias=1
MeasureName=measureAdapterName
MeasureName2=measureIP
MeasureName3=measureNetIn
MeasureName4=measureNetOut
Text=Number : #NICID##CRLF#Adapter: %1#CRLF#IP     : %2#CRLF#NetIn  : %3 B#CRLF#NetOut : %4 B
MouseScrollUpAction=[!SetVariable NICID (Clamp(#NICID#-1,0,20))][!ResetStats][!UpdateMeasure *][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable NICID (Clamp(#NICID#+1,0,20))][!ResetStats][!UpdateMeasure *][!UpdateMeter *][!Redraw]
DynamicVariables=1
As you can see, I added both the NetIn and NetOut measures, as well as the suggested !ResetStats bang (that was a good idea, never thought about that earlier), but when you rapidly scroll through the adapters (or just scrolling to and from the adapter for which you experience the issue), some will momentarily show a "fake" non-zero value before they settle for the actual value in the next update. You can try to find a solution using the simpleton to see how it goes (before hypothetically adding it to your main skin), but I'm not sure there will be a satisfactory answer in that regard. You can try to post this in the Bugs and Features section of the forum and see what the devs think about it as well, but again, I'm not sure it's fixable. By the way, if you somehow find a better answer for this, let me know, because I'm also a bit uncomfortable with the behavior in my Network skin... :???:

EDIT: While [!ResetStats] above didn't work in correcting the issue, "double updating" the said measures worked: so instead of [!UpdateMeasure *] above, you'd do [!UpdateMeasure *][!UpdateMeasure *] (I believe that would mean duplicating the [!UpdateMeasureGroup NICGroup] part in [MeterContainer]'s MouseScroll actions in your skin). There's a downside effect to that though: the trafic will stay at 0 momentarily, again, until it settles on the subsequent update (I know this because I also had my own skins statically monitoring the said traffic when testing). In other words, you basically traded that non-zero value for a zero one, LMAO.

I still believe a post in the bugs section is feasible, not only because of this, but also because apparently using a number for the Interface option in the Net measures above (I let those lines commented out, but you can try and see if you experience the same) doesn't seem to work, only having the adapter's name ... despite the manual saying it works for both strings and numbers.

P.S. While numbers not working in the Interface option is a bug IMHO, the value issue when scrolling might be related to the Per Second section here (scrolling takes less than 1 second, so it may update stuff too soon after the previous update of the Net measures).

EDIT2: I just posted the bug report here. I might be adding the scroll value change as well later on, though I'm not sure that is a bug.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: WAN & LAN and SysInfoType/s

Post by CodeCode »

Heh. The most obvious thing - Update twice.
The long silence is preferable to a 5GB spike that doesn't go away in the Max fields. It also bypasses the need for the user to do anything less intuitive in the design perspective along with functionality being preserved.

I added a couple tweaks.

Code: Select all

[MeasureNICID]
Group=NICGroup
Measure=Calc
Formula=#NICIDDefault#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^-2$":"Total","^-1$":"Best"
OnUpdateAction=[!SetVariable NICID [MeasureNICID]][!WriteKeyValue Variables "NICIDDefault" "[MeasureNICID]"]
DynamicVariables=1
A couple things popped up from that.
The substitute here:

Code: Select all

[MeasureWANIP]
Measure=WebParser
Url=http://checkip.dyndns.org/%22
RegExp="(?siU)<body>(.+)Address: (.+)</body>"
StringIndex=2
RegExpSubstitute=1
Substitute="^(.*)$":"Adapter's WAN IP:  \1"
DynamicVariables=1
Stopped working, until I added an extra space before the \1.
Secondly I noticed that the Substitute in MeasureNICID prevented the the WriteKeyValue for the 1- and -2 values, since they became strings. But in my view that is fine since Best and Total are summary values anyway, not when considering specific monitoring is preferred of key adapters.

Also adding the writekeyvalue gives the benefit of maintaining adapter of choice after those updates, or refreshes.
EDIT:
The updates are generally related to mouse scrolling, and that is what I would think is sensible for a bang to trigger from.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7185
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WAN & LAN and SysInfoType/s

Post by Yincognito »

CodeCode wrote: August 10th, 2021, 1:14 pm Heh. The most obvious thing - Update twice.
The long silence is preferable to a 5GB spike that doesn't go away in the Max fields. It also bypasses the need for the user to do anything less intuitive in the design perspective along with functionality being preserved.

I added a couple tweaks.

Code: Select all

[MeasureNICID]
Group=NICGroup
Measure=Calc
Formula=#NICIDDefault#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^-2$":"Total","^-1$":"Best"
OnUpdateAction=[!SetVariable NICID [MeasureNICID]][!WriteKeyValue Variables "NICIDDefault" "[MeasureNICID]"]
DynamicVariables=1
A couple things popped up from that.
The substitute here:

Code: Select all

[MeasureWANIP]
Measure=WebParser
Url=http://checkip.dyndns.org/%22
RegExp="(?siU)<body>(.+)Address: (.+)</body>"
StringIndex=2
RegExpSubstitute=1
Substitute="^(.*)$":"Adapter's WAN IP:  \1"
DynamicVariables=1
Stopped working, until I added an extra space before the \1.
Secondly I noticed that the Substitute in MeasureNICID prevented the the WriteKeyValue for the 1- and -2 values, since they became strings. But in my view that is fine since Best and Total are summary values anyway, not when considering specific monitoring is preferred of key adapters.

Also adding the writekeyvalue gives the benefit of maintaining adapter of choice after those updates, or refreshes.
EDIT:
The updates are generally related to mouse scrolling, and that is what I would think is sensible for a bang to trigger from.
That's not the right way to do it. Modifying the write key value to [!WriteKeyValue Variables "NICIDDefault" "[#NICID]"], in effect saving just the index, should work better (both #NICID# and #NICIDDefault# are supposed to be the number of the adapter, and not its name). That being said, for a volatile environment those numbers might change on subsequent restarts/reloads/etc. so you should be aware of that possibility.

P.S. Personally, I would either not save that value here and just set it through a "settings" skin, or save it from the [Rainmeter]'s OnCloseAction or similar to avoid writing stuff when scrolling quickly. In my case, though I had the former approach in the beginning, I gave up doing so - after all, it's not that hard to scroll to the desired adapter, not to mention that setting it staticly by using a hardcoded value (probably the -1 for Best in most cases) or from a settings skin is generally acceptable.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: WAN & LAN and SysInfoType/s

Post by CodeCode »

Yincognito wrote: August 10th, 2021, 2:00 pm That's not the right way to do it. Modifying the write key value to [!WriteKeyValue Variables "NICIDDefault" "[#NICID]"], in effect saving just the index, should work better (both #NICID# and #NICIDDefault# are supposed to be the number of the adapter, and not its name). That being said, for a volatile environment those numbers might change on subsequent restarts/reloads/etc. so you should be aware of that possibility.

P.S. Personally, I would either not save that value here and just set it through a "settings" skin, or save it from the [Rainmeter]'s OnCloseAction or similar to avoid writing stuff when scrolling quickly. In my case, though I had the former approach in the beginning, I gave up doing so - after all, it's not that hard to scroll to the desired adapter, not to mention that setting it staticly by using a hardcoded value (probably the -1 for Best in most cases) or from a settings skin is generally acceptable.
Thanks for the correction.

Currently, I am trying to determine which Adapter is the active on. In this case by comparing. The idea is that the active adapter will be a different color. I have the following, but every adapter changes, not just the active, or BEST one.

Code: Select all

[MeasureIsVPN]
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_DESCRIPTION
SysInfoData=Best
IfCondition=MeasureIsVPN = MeasureAdapter
IfTrueAction=[!SetOptionGroup "Visible" "InlineSetting" "GradientColor | 180 | 57,204,79,255 ; 0.0 | #GlobalFontAltColor# ; 0.7"]
DynamicVariables=1
I feel that it is possible, I am just not seeing which comparison or equality of value determine the BEST whilst still being able to scroll through the other ones but with no color change.

Or am I just wrong, and this cannot be done this way?
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: WAN & LAN and SysInfoType/s

Post by CodeCode »

ok. So I realised that there is no way - without a complete redesign - to only highlight the VPN Adapter text and not everything else as well.

So I took that and turned it on its side:
The gradient will have two colors - I'm using blue to gold, and green to gold. Blue for standard net, Green for VPN.
I'm looking at this - but it always turns up TRUE, so something ain't correct. Anyway here is the current version (kind of broke...):

Code: Select all

[MeasureIsVPN]
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_TYPE
SysInfoData=Best
IfCondition=MeasureIsVPN > 0
IfTrueAction=[!SetOption "MeterTextAdapter" "InlineSetting" "GradientColor | 180 | 57,204,79,255 ; 0.0 | #GlobalFontAltColor# ; 0.7"]
IfFalseAction=[!SetOption "MeterTextAdapter" "InlineSetting" "GradientColor | 180 | 57,79,209,255 ; 0.0 | #GlobalFontAltColor# ; 0.7"]
IfConditionMode=1
DynamicVariables=1
So that's just my update - it helps me think, writing it all down as I go... :oops:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7185
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WAN & LAN and SysInfoType/s

Post by Yincognito »

CodeCode wrote: August 10th, 2021, 7:52 pmCurrently, I am trying to determine which Adapter is the active on. In this case by comparing. The idea is that the active adapter will be a different color. I have the following, but every adapter changes, not just the active, or BEST one.

Code: Select all

[MeasureIsVPN]
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_DESCRIPTION
SysInfoData=Best
IfCondition=MeasureIsVPN = MeasureAdapter
IfTrueAction=[!SetOptionGroup "Visible" "InlineSetting" "GradientColor | 180 | 57,204,79,255 ; 0.0 | #GlobalFontAltColor# ; 0.7"]
DynamicVariables=1
I feel that it is possible, I am just not seeing which comparison or equality of value determine the BEST whilst still being able to scroll through the other ones but with no color change.
First, if by any chance your "Visible" group is made of [MeterTextAdapter], be aware that it ALREADY has an InlineSetting on it (the character spacing one), so you'll need to use an InlineSetting2 in your !SetOptionGroup bang or you risk crashing Rainmeter (yes, it happened to me as I tested it out). If your group is made of meter(s) that don't yet have an InlineSetting on them, then skip this change.

Secondly, you cannot use IfConditions on string values like SysInfoType=ADAPTER_DESCRIPTION in your measure is yielding - I thought you knew this by now. So, you have to use IfMatches instead, but even then, in case the adapter name has some other funky characters in it, you need to use the :EscapeRegExp parameter for section variables, to escape the regex resserved characters like any of the +*?^$\.[]{}()|/.

Thirdly, you need to "cancel out" / "revert" the above inline color change for the adapters different than the "Best" one, if you don't want stuff having the same color - logical, right?

Fourth, while with the changes above your approach would have worked, I recomment inverting a bit the test and placing this in [MeasureAdapter] instead, since you have other similar color changes there already (you can even add [MeasureIsVPN] to the NICGroup if you like, or set it with an UpdateDivider=-1 if you think the "VPN" will not change).

So, assuming your "Visible" group is made of [MeterTextAdapter], this boils down to:

Code: Select all

[MeasureIsVPN]
Group=NICGroup
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_DESCRIPTION
SysInfoData=Best

[MeasureAdapter]
Group=NICGroup
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_DESCRIPTION
SysInfoData=#NICID#
RegExpSubstitute=1
Substitute="(?:^\s+|\s+$)":"","(^$|^0$)":"Unavailable Adapter","#IPSkinVPNFullName#":"Private  Internet  Adapter","#IPSkinAdapterFullName#":"Standard  Internet  Adapter"
IfCondition=MeasureNICID=-2
IfTrueAction=[!SetOptionGroup NetGroup Interface 0][!SetOption MeasureNICIPAddress SysInfoData 0][!SetOption MeterTextAdapterInvisible MeasureName "MeasureNICID"][!SetOption MeterTextAdapter MeasureName "MeasureNICID"]
IfCondition2=MeasureNICID=-1
IfTrueAction2=[!SetOptionGroup NetGroup Interface [MeasureAdapter]][!SetOption MeasureNICIPAddress SysInfoData [MeasureAdapter]][!SetOption MeterTextAdapterInvisible MeasureName "MeasureNICID"][!SetOption MeterTextAdapter MeasureName "MeasureNICID"]
IfCondition3=MeasureNICID>=0
IfTrueAction3=[!SetOptionGroup NetGroup Interface [MeasureAdapter]][!SetOption MeasureNICIPAddress SysInfoData [MeasureAdapter]][!SetOption MeterTextAdapterInvisible MeasureName "MeasureAdapter"][!SetOption MeterTextAdapter MeasureName "MeasureAdapter"]
IfConditionMode=1
IfMatch=^.{2,}$
IfMatchAction=[!EnableMeasureGroup NetGroup][!EnableMeasure MeasureNICIPAddress][!SetOption MeterTextAdapter FontColor "#GlobalFontAltColor#"]
IfNotMatchAction=[!DisableMeasureGroup NetGroup][!SetOption MeasureNICIPAddress SysInfoData 999][!SetOption MeterTextAdapter FontColor "0,0,255,255"]
IfMatch2=^[MeasureIsVPN:EscapeRegExp]$
IfMatchAction2=[!SetOptionGroup Visible InlineSetting2 "GradientColor | 180 | 57,204,79,255 ; 0.0 | #GlobalFontAltColor# ; 0.7"]
IfNotMatchAction2=[!SetOptionGroup Visible InlineSetting2 "None"]
IfMatchMode=1
DynamicVariables=1
The last IfMatch was all it took. ;-)

P.S. Bear in mind that the above is based on my last posted code, you figure out things if you made other modifications in the meantime.
P.S.S. You can change the None seting above with your updated GradientColor | 180 | 57,79,209,255 ; 0.0 | #GlobalFontAltColor# ; 0.7 if you like, of course.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: WAN & LAN and SysInfoType/s

Post by CodeCode »

Ok, so hello - The form I am using is the same as your updated code, with the exception that the InlineSetting does not require the 2, since I removed the spacing in the view that it would buy some extra characters and reduce the need for font resizing.

And, your example works. Everything appears to be working in every aspect we have created.

This bloody skin is going to require an owner's manual! :rofl:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7185
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WAN & LAN and SysInfoType/s

Post by Yincognito »

CodeCode wrote: August 10th, 2021, 11:29 pmThis bloody skin is going to require an owner's manual! :rofl:
A scrolling owner's manual! :lol:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: WAN & LAN and SysInfoType/s

Post by CodeCode »

Yincognito wrote: August 10th, 2021, 11:34 pm A scrolling owner's manual! :lol:
With an update=24. :vomit:

And so the story begins, the end.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.