It is currently March 28th, 2024, 10:55 pm

Skin switching between wired and wireless network.

Get help with creating, editing & fixing problems with skins
Bub
Posts: 37
Joined: April 2nd, 2014, 3:52 pm

Skin switching between wired and wireless network.

Post by Bub »

G'day guys.
I have a skin and want it to change displayed info between wired and wireless connection.

While rig connected wired (most of the time) I want SSID and Signal display something like "none" or such.
And when laptop on wifi I want it to update IP and WAN and display SSID and Signal info.
SO far what I got on wired connection is SSID displaying "-1" and Signal "0%"

Will gladly accept any help :great:

Code: Select all

[Variables]
@include=#@#Options.inc
BestInterface=Best

;=============================================
;Measures
;=============================================
[MeasureAdapter]
Measure=Plugin
Plugin=SysInfo
SysInfoData=#BestInterface#
SysInfoType=ADAPTER_TYPE
Interface=#BestInterface#


[Measure.Download]
Measure=NetIn
Interface=#BestInterface#
AverageSize=2

[Measure.Upload]
Measure=NetOut
Interface=#BestInterface#
AverageSize=2

[Measure.IP]
Measure=Plugin
Plugin=SysInfo
SysInfoType=IP_ADDRESS
SysInfoData=#BestInterface#

[Measure.WAN]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=http://checkip.dyndns.org
RegExp="(?siU)Address: (.*)</body>"
StringIndex=1
UpdateRate=-1000

[Measure.SSID]
Measure=Plugin
Plugin=WiFiStatus
WiFiInfoType=SSID


[Measure.Signal]
Measure=Plugin
Plugin=WiFiStatus
WiFiInfoType=Quality


;=============================================
;Background
;=============================================
[Meter.Background]
Meter=Image
X=0
Y=0
H=84
W=300
SolidColor=#Background.color#
LeftMouseDownAction=[Shell:::{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}]

;=============================================
;Static Strings
;=============================================

[Meter.Header]
Meter=String
X=75		
Y=24
StringAlign=Right
FontColor=#FontColor#
FontSize=#FontHeight1#
FontFace=#Font#
AntiAlias=1
Text="NET"

;=============================================
;Graphs
;=============================================
[Meter.Download_Graph_Line]
Meter=Line
MeasureName=Measure.Download
X=80
Y=5
H=21
W=140
LineCount=1
LineColor=#graph.line1#
AntiAlias=1
AutoScale=1
;SolidColor=80,80,120,200


[Meter.Download_Graph_Fill]
Meter=Histogram
MeasureName=Measure.Download
X=80
Y=0r
H=20
W=140
PrimaryColor=#graph.line1#
AntiAlias=1
AutoScale=1

[Meter.Upload_Graph_Line]
Meter=Line
MeasureName=Measure.Upload
X=80
Y=30
H=21
W=140
LineCount=1
LineColor=#graph.line2#
AntiAlias=1
AutoScale=1
Flip=1
;SolidColor=80,80,120,200

[Meter.Upload_Graph_Fill]
Meter=Histogram
MeasureName=Measure.Upload
X=80
Y=0r
H=20
W=140
PrimaryColor=#graph.line2#
AntiAlias=1
AutoScale=1
Flip=1

;[Meter.Bar_Graph]
;Meter=Bar
;MeasureName=Measure.Signal
;X=80
;Y=56
;W=220
;H=10
;BarColor=#graph.line1#
;SolidColor=#graph.line2#
;BarOrientation=Horizontal

;=============================================
;Dynamic Strings
;=============================================
[Meter.Download_Speed]
Meter=String
MeasureName=Measure.Download
X=295
Y=15
StringAlign=Right
FontColor=#FontColor#
FontSize=#FontHeight2#
FontFace=#Font#
AntiAlias=1
NumOfDecimals=0
AutoScale=1
Text="%1B/s [D]"

[Meter.Upload_Speed]
Meter=String
MeasureName=Measure.Upload
X=295
Y=15r
FontColor=#FontColor#
;FontColor=#FontColor2#
FontSize=#FontHeight2#
FontFace=#Font#
AntiAlias=1
NumOfDecimals=0
AutoScale=1
Text="%1B/s [U]"
StringAlign=Right

[Meter.IP]
MeasureName=Measure.IP
Meter=String
X=85
Y=60
StringAlign=Left
FontColor=#FontColor#
FontSize=#FontHeight2#
FontFace=#Font#
AntiAlias=1
Prefix="IP: "

[Meter.WAN]
MeasureName=Measure.WAN
Meter=String
X=295
Y=0r
StringAlign=Right
FontColor=#FontColor#
FontSize=#FontHeight2#
FontFace=#Font#
AntiAlias=1
Prefix="WAN: "


[Meter.SSID]
MeasureName=Measure.SSID
Meter=String
X=85
Y=14r
FontColor=#FontColor#
FontSize=#FontHeight2#
FontFace=#Font#
AntiAlias=1
Text="SSID: %1"

[Meter.Signal_Quality]
MeasureName=Measure.Signal
Meter=String
X=295
Y=0r
StringAlign=Right
FontColor=#FontColor#
FontSize=#FontHeight2#
FontFace=#Font#
AntiAlias=1
Text="SIGNAL: %1%"
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Skin switching between wired and wireless network.

Post by jsmorley »

You can test for "Wireless" as the adapter type with IfMatch, and take whatever action you want based on that. Be sure to use DynamicVariables=1 on the measure so it will detect the change from wired to wireless in real time.

Code: Select all

[MeasureAdapter]
Measure=Plugin
Plugin=SysInfo
SysInfoData=#BestInterface#
SysInfoType=ADAPTER_TYPE
DynamicVariables=1
IfMatch=Wireless
IfMatchAction=[!ShowMeter Meter.SSID][!SetOption Meter.Signal_Quality Text "SIGNAL: %1%"][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!HideMeter Meter.SSID][!SetOption Meter.Signal_Quality Text "Ethernet"][!UpdateMeter *][!Redraw]
https://docs.rainmeter.net/manual/measures/general-options/ifmatchactions/
https://docs.rainmeter.net/manual/bangs/#SetOption

I use this approach all the time...

https://jsmorley.deviantart.com/art/NetworkPanel-1-0-626627189

The only other comment I would make is to use LeftMouseUpAction instead of the annoying and almost, but not quite, always incorrect LeftMouseDownAction.
Bub
Posts: 37
Joined: April 2nd, 2014, 3:52 pm

Re: Skin switching between wired and wireless network.

Post by Bub »

Thanks a lot.
But here is question, what should I change here?

Code: Select all

[Variables]
@include=#@#Options.inc

;=============================================
;Measures
;=============================================
[Measure.Download]
Measure=NetIn
Interface=#BestInterface#
AverageSize=2

[Measure.Upload]
Measure=NetOut
Interface=#BestInterface#
AverageSize=2

[MeasureAdapter]
Measure=Plugin
Plugin=SysInfo
SysInfoData=#BestInterface#
SysInfoType=ADAPTER_TYPE
DynamicVariables=1
IfMatch=Wireless
IfMatchAction=[!ShowMeter Meter.SSID][!SetOption Meter.Signal_Quality Text "SIGNAL: %1%"][!UpdateMeter *][!Redraw]
IfNotMatchAction=[!HideMeter Meter.SSID][!SetOption Meter.Signal_Quality Text "Ethernet"][!UpdateMeter *][!Redraw]


[Measure.Signal]
Measure=Plugin
Plugin=WiFiStatus
WiFiInfoType=Quality

[Measure.SignalQuality]
Measure=Calc
Formula=Measure.Signal/100

[Measure.IP]
Measure=Plugin
Plugin=SysInfo
SysInfoType=IP_ADDRESS
SysInfoData=0

[Measure.WAN]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=http://checkip.dyndns.org
RegExp="(?siU)Address: (.*)</body>"
StringIndex=1
UpdateRate=-1
To make in switch between wireless and wired?
'cos SSD does not showing up at all and "Signal" stays on "Ethernet" all the time.
Thanks in advance! :great:
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: Skin switching between wired and wireless network.

Post by SilverAzide »

Bub wrote:To make in switch between wireless and wired?
'cos SSD does not showing up at all and "Signal" stays on "Ethernet" all the time.
Thanks in advance! :great:
You deleted the line BestInterface=Best that was in your original post, which broke the code. Either put it back, or get rid of the #BestInterface# variable altogether and just use Best.
Gadgets Wiki GitHub More Gadgets...
Bub
Posts: 37
Joined: April 2nd, 2014, 3:52 pm

Re: Skin switching between wired and wireless network.

Post by Bub »

SilverAzide wrote:You deleted the line BestInterface=Best that was in your original post, which broke the code. Either put it back, or get rid of the #BestInterface# variable altogether and just use Best.
Em... Hard to find correct smile to describe my status right now.
You should add more smiles like dumbass or such.

Thank you so much, good sir :bow: :great:
User avatar
SilverAzide
Rainmeter Sage
Posts: 2588
Joined: March 23rd, 2015, 5:26 pm

Re: Skin switching between wired and wireless network.

Post by SilverAzide »

Bub wrote:Thank you so much, good sir :bow: :great:
No problem! :) Also, don't forget, per the docs:

When the option is set to Best, DynamicVariables=1 must be set on the measure if you want it to automatically react to changes in the active interface. This should be done if for instance you have a laptop or other computer that you switch between wired and wireless connections.
Gadgets Wiki GitHub More Gadgets...