- 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]"]
Last edited by brax64 on September 16th, 2020, 2:27 am, edited 1 time in total.
brax64 wrote: ↑September 15th, 2020, 7:30 pm
- Why, in order to make it works, I've to use [!SetOption IPText Text "[*WAN*]" instead of [!SetOption IPText Text "[WAN]"]
brax64 wrote: ↑September 15th, 2020, 7:30 pm
- 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...)
[WAN]
Measure=WebParser
URL=https://api.ipify.org/
RegExp=^(.*)$
StringIndex=1
UpdateRate=600
[Adapter]
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_DESCRIPTION
SysInfoData=Best
DynamicVariables=1
[VPNCheck]
Measure=String
String=[Adapter]
DynamicVariables=1
IfMatch=#Adapter#
IfMatchAction=[!SetOption VPNIcon ImageName "#path#vpnon.png"][!SetOption IPText Text "[*WAN*]"]#U2#
IfNotMatchAction=[!SetOption VPNIcon ImageName "#path#vpnoff.png"][!SetOption IPText Text "VPN is off . . ."]#U2#
OnChangeAction=[!CommandMeasure WAN "Update"]
See, that was easy - no point in using numerical IfConditions where string capable IfMatches can do. By the way, if the U2 variable or other considerations in your skin don't interfere with this, you can get rid of [VPNCheck] and move your IfMatch and OnChangeAction directly into [Adapter]. Creating duplicate measures is useful in cases where you can't do what you want in the original measure, but I doubt this is such a case here...
Yincognito wrote: ↑September 16th, 2020, 8:21 am
See, that was easy - no point in using numerical IfConditions where string capable IfMatches can do. By the way, if the U2 variable or other considerations in your skin don't interfere with this, you can get rid of [VPNCheck] and move your IfMatch and OnChangeAction directly into [Adapter]. Creating duplicate measures is useful in cases where you can't do what you want in the original measure, but I doubt this is such a case here...
Hi Yincognito,
Thank for the tip! Moved IfMatch and OnChangeAction directly to the [Adapter] measure and got rid off the [VPNCheck] measure, nice and clean!
Sometimes I miss simple solutions and get lost over thinking the problem... well, I'm happy 'cause I've been able to find a solution and learnt a little more
brax64 wrote: ↑September 16th, 2020, 10:01 am
Hi Yincognito,
Thank for the tip! Moved IfMatch and OnChangeAction directly to the [Adapter] measure and got rid off the [VPNCheck] measure, nice and clean!
Sometimes I miss simple solutions and get lost over thinking the problem... well, I'm happy 'cause I've been able to find a solution and learnt a little more
Yeah, no problem. It's simple things like these that can shorten the code, since the length and the redundancy of the code is one of the things users keep mentioning (read complaining) about when it comes to Rainmeter.