Checking Network Adapter...
Posted: September 15th, 2020, 7:30 pm
Hi all,
This is the code I've came up with:
It's working but I've few question about it:
- How can I avoid to describe the default adapter (Realtek PCIe GBE Family Controller) but simply verify if the Kaspersky one (VPN) is in use or not? If I don't describe the default adapter (Realtek), can't use !IfFalseAction instead of !IfCondition2 in the [VPNCheck] measure because i get an error (Calc: "Realtek" is unknown (Gruvy\Dash\Gruvy.ini - [VPNCheck])
- How can I update the [WAN] measure on the fly when [Adapter] measure's value change and leave the UpdateRate=600 just to check periodically if the IP address has changed (Kaspersky VPN it change address randomly, I guess it depends by traffic in order to get the best service...)
- Why, in order to make it works, I've to use [!SetOption IPText Text "[*WAN*]" instead of [!SetOption IPText Text "[WAN]"]
This is the code I've came up with:
Code: Select all
[Variables]
Adapter=Kaspersky Security Data Escort Adapter
U2=[!UpdateMeterGroup IP][!Redraw]
path=#@#Images\
[Adapter]
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_DESCRIPTION
SysInfoData=Best
DynamicVariables=1
Substitute="#Adapter#":"1","Realtek PCIe GBE Family Controller":"0"
[WAN]
Measure=WebParser
URL=https://api.ipify.org/
RegExp=^(.*)$
StringIndex=1
UpdateRate=600
[VPNCheck]
Measure=Calc
Formula=[Adapter]
IfCondition=VPNCheck = 1
IfTrueAction=[!SetOption VPNIcon ImageName "#path#vpnon.png"][!SetOption IPText Text "[*WAN*]"]#U2#
IfCondition2=VPNCheck = 0
IfTrueAction2=[!SetOption VPNIcon ImageName "#path#vpnoff.png"][!SetOption IPText Text "VPN is off . . ."]#U2#
DynamicVariables=1
[VPNIcon]
Meter=Image
Group=IP
ToolTipText=VPN
SolidColor=0,0,0,1
X=75
Y=535
W=30
[IPText]
Meter=String
Group=IP
MeterStyle=TextStyle
X=45r
Y=8r
DynamicVariables=1
- How can I avoid to describe the default adapter (Realtek PCIe GBE Family Controller) but simply verify if the Kaspersky one (VPN) is in use or not? If I don't describe the default adapter (Realtek), can't use !IfFalseAction instead of !IfCondition2 in the [VPNCheck] measure because i get an error (Calc: "Realtek" is unknown (Gruvy\Dash\Gruvy.ini - [VPNCheck])
- How can I update the [WAN] measure on the fly when [Adapter] measure's value change and leave the UpdateRate=600 just to check periodically if the IP address has changed (Kaspersky VPN it change address randomly, I guess it depends by traffic in order to get the best service...)
- Why, in order to make it works, I've to use [!SetOption IPText Text "[*WAN*]" instead of [!SetOption IPText Text "[WAN]"]