It is currently May 7th, 2024, 2:25 am

Can anyone help me figure out why variables arent displaying

Get help with creating, editing & fixing problems with skins
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Can anyone help me figure out why variables arent displaying

Post by death.crafter »

LooseAllTheMonies wrote: August 2nd, 2021, 8:45 pm Right so the code was actually changed due to trying to debug why it wasn't working but essentially I'm checking to see if the IP address at that registry location has changed, and if it has then I would like to update the IP address at #VPNNameServer# so it should actually be IfNotMatch.
Use OnChangeAction?

Code: Select all

[MeasureIP]
...
OnChangeAction=[!EnableMeasure MeasureStringIP][!UpdateMeasure MeasureStringIP][!DisableMeasure MeasureStringIP]

[MeasureStringIP]
Measure=String
String=[MeasureIP]
IfMatch=^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$
IfMatchAction=[!SetVariable IPAd "[MeasureIP]"]
IfNotMatchAction=[!SetVariable IPAd ""]
DynamicVariables=1
Disabled=1
from the Realm of Death
LooseAllTheMonies
Posts: 14
Joined: July 29th, 2021, 6:52 am

Re: Can anyone help me figure out why variables arent displaying

Post by LooseAllTheMonies »

death.crafter wrote: August 2nd, 2021, 9:31 pm Use OnChangeAction?

Code: Select all

[MeasureIP]
...
OnChangeAction=[!EnableMeasure MeasureStringIP][!UpdateMeasure MeasureStringIP][!DisableMeasure MeasureStringIP]

[MeasureStringIP]
Measure=String
String=[MeasureIP]
IfMatch=^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$
IfMatchAction=[!SetVariable IPAd "[MeasureIP]"]
IfNotMatchAction=[!SetVariable IPAd ""]
DynamicVariables=1
Disabled=1
So actually this is exactly what I'm looking for ... However it doesn't seem to work for me, at least not fully. After [MeasureStringIP] detects a change I'm using [!UpdateMeasureGroup WANMeasures] to update a group of measures. This group of measures if based off of a WebParser measure (which should run first) and then a bunch of calc measures that calculate different positions/values based on the return values of the WebParser measure however nothing seems to be updating, do I have to split these two groups up? Tell the webparser measures to update and then tell the calc measures based on these values to update? I'm doing them all in one shot and it's not working which is why im asking. Also they all have an UpdateRate=-1 however UpdateMeasureGroup should over ride this no?

This is what I have for refrence:

Code: Select all

[MeasureIPRegistryValue]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
;RegKey=SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\[MeasureInterfaceGUID]
RegKey=SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{afdeecba-dfba-caff-5044-013412bceacd}
RegValue=NameServer
OnChangeAction=[!EnableMeasure MeasureStringIP][!UpdateMeasure MeasureStringIP][!DisableMeasure MeasureStringIP]

[MeasureVerifyStringIP]
Measure=String
String=[MeasureIPRegistryValue]
IfMatch=^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$
IfMatchAction=[!SetVariable VPNNameServer "Matched"][!UpdateMeasureGroup WANMeasures][!UpdateMeterGroup WANMeters]
IfNotMatchAction=[!SetVariable VPNNameServer "Not matched"]
DynamicVariables=1
Disabled=1
By the way see the RegKey that's been commented out? I cant get a previous measure [MeasureInterfaceGUID] to resolve to it's value and then get the correct location, I have to enter it manually as you can see and I dont understand why.

Again thank you for helping so much yet again.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Can anyone help me figure out why variables arent displaying

Post by death.crafter »

LooseAllTheMonies wrote: August 3rd, 2021, 12:48 am This group of measures if based off of a WebParser measure (which should run first) and then a bunch of calc measures that calculate different positions/values based on the return values of the WebParser measure however nothing seems to be updating, do I have to split these two groups up?
If they are webparser measures, you gotta use [!CommandMeasure MeasureName Update]

And yes only updating the parent measures will do.
from the Realm of Death
User avatar
Yincognito
Rainmeter Sage
Posts: 7206
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Can anyone help me figure out why variables arent displaying

Post by Yincognito »

LooseAllTheMonies wrote: August 3rd, 2021, 12:48 am By the way see the RegKey that's been commented out? I cant get a previous measure [MeasureInterfaceGUID] to resolve to it's value and then get the correct location, I have to enter it manually as you can see and I dont understand why.
That should work, it did for me using the same code in a similar environment. Make sure you don't have sections using the same name in the skin, try using the nested syntax of [&MeasureInterfaceGUID] and see if that helps, check the update / update divider workflow to see if the order in which stuff happens is the right one, and if nothing else works, use [!Log ...] bangs at "strategic" points in the execution in the relevant measures to see whether that measure value is set properly and it's not "lost" somewhere in the process.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16201
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can anyone help me figure out why variables arent displaying

Post by balala »

death.crafter wrote: August 2nd, 2021, 5:06 am And are you sure you don't have any special characters in the mentioned #VPNNameServer# {.,(,),[,],{,}}.
Not entirely sure what do you mean by "special characters", but if you mean reserved characters, they indeed
must be escaped with the \ character when used as a literal in the IfMatch option.
However note that not all listed characters are reserved ones, but there are some others which are. Here you can find the list of reserved characters.
Note that for instance both parentheses ( and ) are reserved, but for instance only the opening [ and { are, while the closing ] and } are not.
Sorry if you meant something else and I misunderstood you.
User avatar
Yincognito
Rainmeter Sage
Posts: 7206
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Can anyone help me figure out why variables arent displaying

Post by Yincognito »

balala wrote: August 3rd, 2021, 10:29 am Not entirely sure what do you mean by "special characters", but if you mean reserved characters, they indeed

However note that not all listed characters are reserved ones, but there are some others which are. Here you can find the list of reserved characters.
Note that for instance both parentheses ( and ) are reserved, but for instance only the opening [ and { are, while the closing ] and } are not.
Sorry if you meant something else and I misunderstood you.
Actually, one can use \ (or \\ when the character is also a character class) to escape pretty much any literal character in a regex pattern, not just the reserved ones (e.g. \a is the same as plain a, and \\d is the same as plain d). The only difference is that for the reserved ones this is a requirement.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16201
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can anyone help me figure out why variables arent displaying

Post by balala »

Yincognito wrote: August 3rd, 2021, 10:57 am Actually, one can use \ (or \\ when the character is also a character class) to escape pretty much any literal character in a regex pattern, not just the reserved ones (e.g. \a is the same as plain a, and \\d is the same as plain d). The only difference is that for the reserved ones this is a requirement.
Right, but what I said was related to the fact that not all listed characters are reserved and not all reserved characters were listed there.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Can anyone help me figure out why variables arent displaying

Post by death.crafter »

balala wrote: August 3rd, 2021, 11:30 am Right, but what I said was related to the fact that not all listed characters are reserved and not all reserved characters were listed there.
All I needed to show was . considering it was IPv4, rest were just examples. Term was wrong tho.
from the Realm of Death
User avatar
Yincognito
Rainmeter Sage
Posts: 7206
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Can anyone help me figure out why variables arent displaying

Post by Yincognito »

balala wrote: August 3rd, 2021, 11:30 am Right, but what I said was related to the fact that not all listed characters are reserved and not all reserved characters were listed there.
Of course. I love the play of words there - was it intentional? :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
LooseAllTheMonies
Posts: 14
Joined: July 29th, 2021, 6:52 am

Re: Can anyone help me figure out why variables arent displaying

Post by LooseAllTheMonies »

Ok so again thank you for all the help you guys have been great!
I scratched checking the registry values for an easier method of just monitoring the local IP, as if I switch VPN servers even though the local IP doesn't seem to change it actually does momentarily, enough to catch it by using SysInfoData=Best as it will automatically detect the disconnection switch to another Network interface card and then switch back to the emulated network interface card once the VPN tunnel connects to another server.

The issue now is there is a delay between the switching of NIC's and if I simply request or tell Webparser to update during that time (more specifically when my IP measure first notice's the IP change there is no connection during that time) it will simply fail. I tried to find a way to delay the update by using the following (with rainmeter Update=500 this should be 2.5 seconds after the initial change detection) but it doesn't seem to work, is there a better alternative? Googling around has shown me that RainMeter doesn't natively support any type of delays so I tried to hack one together but it doesnt seem to be working, it will update the DelayCounter up to 1 but then stop.

Code: Select all

[Variables]
DelayCounter=0

[MeasureLocalIP]
Measure=Plugin
Plugin=SysInfo
SysInfoType=IP_ADDRESS
SysInfoData=Best
DynamicVariables=1
OnChangeAction=[!EnableMeasure MeasureDelayThenUpdate]
;Group=WANMeasures

;following delay is needed as it takes some time between noticing an IP change and actually connecting to VPN server if we request a website during that time it will fail
[MeasureDelayThenUpdate]
Measure=Calc
Formula=#DelayCounter#
IfCondition=#DelayCounter# < 6
IfTrueAction=[!SetVariable DelayCounter "(#DelayCounter#+1)"][!EnableMeasure MeasureDelayThenUpdate]
IfFalseAction=[!SetVariable DelayCounter 0][!CommandMeasure MeasureIP Update][!UpdateMeasureGroup WANMeasures][!UpdateMeterGroup WANMeters][!DisableMeasure MeasureDelayThenUpdate]
DynamicVariables=1
Disabled=1
Originally I had IfTrueAction=[!SetVariable DelayCounter "(#DelayCounter#+1)"] but then I added [!EnableMeasure MeasureDelayThenUpdate] as that measure is set as disabled and wasn't updating and I thought that might be part of the reason although it's not.