It is currently April 19th, 2024, 4:41 am

Help Getting Adapter Type Plugin to Show None

Get help with creating, editing & fixing problems with skins
thejlowe
Posts: 2
Joined: November 7th, 2019, 10:51 pm

Help Getting Adapter Type Plugin to Show None

Post by thejlowe »

I need help to get my skin to show None when it's not connected to Wireless or Ethernet.

I have this for my skin but it's only Showing "Ethernet" and Wireless" when connected via Ethernet or Wi-Fi. I would like it show "None" when connected to neither though and am having trouble getting that going.

Bonus: If I can get it to show "Ethernet and Wireless" when connected to both, that would be great! If not, I'm fine with that.

Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_TYPE
SysInfoData=Best

After this point, I've tried various combinations but have had no luck. Anybody have any suggestions on how to do this?
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Help Getting Adapter Type Plugin to Show None

Post by mak_kawa »

For me, following code does work.

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=128,128,128,192

[Variables]
ConnectionStatus=""

[MeasureAdapter]
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_TYPE
SysInfoData=Best
DynamicVariables=1

[MeasureInternetConnection]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
SysInfoData=Best
IfConditionMode=1
IfCondition=MeasureInternetConnection=1
IfTrueAction=[!SetVariable ConnectionStatus [MeasureAdapter]]
IfFalseAction=[!SetVariable ConnectionStatus -None-]
DynamicVariables=1

[MeterAdapter]
Meter=String
W=75
Text=#ConnectionStatus#
DynamicVariables=1
Unfortunately, I could not achieve the "Ethernet and Wireless" expression when both connections are active...
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Help Getting Adapter Type Plugin to Show None

Post by mak_kawa »

But if you mean "connected" as "connected to the network other than Internet" (ex. LAN), this code probably does not work as intended, I am not sure.
thejlowe
Posts: 2
Joined: November 7th, 2019, 10:51 pm

Re: Help Getting Adapter Type Plugin to Show None

Post by thejlowe »

I am indeed going for connected to the LAN, I apologize. Internet we don't care about but specifically connected to a specific Adapter (Ex. Ethernet, Wireless, or None).
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Help Getting Adapter Type Plugin to Show None

Post by mak_kawa »

For LAN connection, SysInfoType=LAN_CONNECTIVITY may work. But, because I have no exact LAN environment, can not confirm whether this code works or not.

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=128,128,128,192

[Variables]
InternetConnectionStatus=""
LANConnectionStatus=""

[MeasureAdapter]
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_TYPE
SysInfoData=Best
DynamicVariables=1

[MeasureInternetConnection]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
SysInfoData=Best
IfConditionMode=1
IfCondition=MeasureInternetConnection=1
IfTrueAction=[!SetVariable InternetConnectionStatus [MeasureAdapter]]
IfFalseAction=[!SetVariable InternetConnectionStatus -None-]
DynamicVariables=1

[MeasureLANConnection]
Measure=Plugin
Plugin=SysInfo
SysInfoType=LAN_CONNECTIVITY
SysInfoData=Best
IfConditionMode=1
IfCondition=MeasureLANConnection=1
IfTrueAction=[!SetVariable LANConnectionStatus [MeasureAdapter]]
IfFalseAction=[!SetVariable LANConnectionStatus -None-]
DynamicVariables=1

[MeterAdapter]
Meter=String
W=120
Text=Internet:#InternetConnectionStatus##CRLF#LAN:#LANConnectionStatus#
DynamicVariables=1
This code continues to show that Internet connection is active (Ethernet or Wireless), even when I disconnected cable between my home router and WAN terminal. I am not sure why.
User avatar
Jeff
Posts: 327
Joined: September 3rd, 2018, 11:18 am

Re: Help Getting Adapter Type Plugin to Show None

Post by Jeff »

thejlowe wrote: November 7th, 2019, 10:58 pm I would like it show "None" when connected to neither though and am having trouble getting that going.
Add Substitute="0":"None" to the measure that has SysInfoType=ADAPTER_TYPE.
That's it, no other IfConditions or anything else, just use MeasureName to get the info from that measure.
thejlowe wrote: November 7th, 2019, 10:58 pm Bonus: If I can get it to show "Ethernet and Wireless" when connected to both, that would be great! If not, I'm fine with that.
I don't know if that is possible since Windows switches to primarily only one of the internet connections and the measures will do the same as well, though, as mak_kawa pointed out, LAN_CONNECTIVITY would work and IfCondition=((Lan = 1) && (Adapter = 71)) could have worked to detect if you're both connected with the ethernet cable but using the wireless modem to receive info (cause it can't do both at the same time... not yet... 2080 here we come)
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Help Getting Adapter Type Plugin to Show None

Post by mak_kawa »

Hi Jeff

You are correct. Such IfConditions are totally unnecessary. :-)

But I noticed a weird thing about ADAPTER_TYPE option of sysinfo plugin. Maybe I am missing something. Appreciate any help.

I have both ethernet and WiFi adapters on my Windows10 PC. And when I disabled two adapters from the Windows10 setting dialog for network adapters, output from the ADAPTER_TYPE measure is still "6" and "Ethernet", not "0".

In fact, my Windows10 has one more "network adapter", Bluetooth, as well as other normal Windows10. When I disabled also Bluetooth adapter, the ADAPTER_TYPE measure finally returns "0". Probably, this is normal behavior of sysinfo plugin. But I am wondering why it returns "6" instead of "0" (or "1"?) while Ethernet adapter is inactive??
User avatar
SilverAzide
Rainmeter Sage
Posts: 2603
Joined: March 23rd, 2015, 5:26 pm

Re: Help Getting Adapter Type Plugin to Show None

Post by SilverAzide »

mak_kawa wrote: November 8th, 2019, 8:48 amIn fact, my Windows10 has one more "network adapter", Bluetooth, as well as other normal Windows10. When I disabled also Bluetooth adapter, the ADAPTER_TYPE measure finally returns "0". Probably, this is normal behavior of sysinfo plugin. But I am wondering why it returns "6" instead of "0" (or "1"?) while Ethernet adapter is inactive??
Open a Powershell window and execute the following command:

Code: Select all

Get-WmiObject -Class MSFT_NetAdapter -Namespace root\StandardCimv2 | Sort-Object -Property InterfaceType, Virtual, InterfaceDescription | Format-Table -Property @{Label='Interface Name'; Expression={$_.InterfaceDescription}}, @{Label='Connection'; Expression={$_.Name}}, Virtual, State, @{Label='Type'; Expression={$_.InterfaceType}} -AutoSize
Note the "Type" of your Bluetooth adapter.
Gadgets Wiki GitHub More Gadgets...
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Help Getting Adapter Type Plugin to Show None

Post by mak_kawa »

Hi SilverAzide

Your suggestion completely solved my confusion. How did you get such incredible powershell command? I can't imagine at all as an end-user of Windows.

Anyway, now I know why Jeff's solution can't help me. Bluetooth is equal to Ethernet in terms of Adapter Type for me. Just one more qustion arose in my dull brain. :-)

The Type of Bluetooth adapter is "6" in every Windows10 and Bluetooth adapter? If yes, Jeff's solution seems to be not applicable at least to Windows10 with Bluetooth.
Or only me?? :-) In other Windows PC with Bluetooth, the Sysinfo plugin with SysInfoType=ADAPTER_TYPE returns "1" (= some other type of network interface) or "0" when Ethernet and Wifi adapter are disabled??
User avatar
SilverAzide
Rainmeter Sage
Posts: 2603
Joined: March 23rd, 2015, 5:26 pm

Re: Help Getting Adapter Type Plugin to Show None

Post by SilverAzide »

As far as I know, ADAPTER_TYPE will only return 0 when there are no active network adapters left to report. This is because of using SysInfoData=Best, which will cause Rainmeter to choose the "best" remaining active adapter until none are left. For the OP, the best way to tell if there is no active adapter is to use your suggestion of SysInfoType=LAN_CONNECTIVITY. If there's no LAN connected, there certainly won't (can't) be a WAN connected, so this should be a reliable indicator. If you REALLY want to get serious, then don't use Rainmeter... there are more precise ways to determine if specific adapters are active.
Gadgets Wiki GitHub More Gadgets...