It is currently April 26th, 2024, 5:58 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: July 31st, 2021, 6:52 am Disregard...Sorry...How does one delete a post?
Although while I have the space ...is there like some sort of community database of skins I can submit my shitty skins to be included in? I put a lot of time into a really simple skin that I like and would like to share it with people and receive feedback.
DeviantArt

Forums Sharing Thread
from the Realm of Death
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: July 31st, 2021, 6:42 pm As death.crafter said, you can't. What would you like to delete?
The same post you replied to. He edited it to add the contents later.
I guess.
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 16172
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: July 31st, 2021, 6:59 pm
I guess.
That's why I'm waiting LooseAllTheMonies to reply, saying exactly if you are right.
User avatar
Yincognito
Rainmeter Sage
Posts: 7164
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: July 31st, 2021, 7:02 pm That's why I'm waiting LooseAllTheMonies to reply, saying exactly if you are right.
Last edited by LooseAllTheMonies on 31 Jul 2021, 10:30, edited 1 time in total.
Q.E.D.

But of course, a confirmation from the source can be invaluable. ;-)
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 »

Yea sorry had a night out wrote some stuff that wasn't really beneficial to the convo and kind of regretted it later so I edited it out and the tried to delete it. Nothing bad just ... yea... kind of lovey dovey thanking going around that I would not have wrote if I was not in that state of mind.
LooseAllTheMonies
Posts: 14
Joined: July 29th, 2021, 6:52 am

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

Post by LooseAllTheMonies »

I have another issue, if anyone is still checking this thread and would like to help even more again greatly appreciate any and all help.

I'm trying to check registry to see if/when a VPN becomes active and i've located a registry which seems to change however I'm having issue getting IfMatch to work and also update a variable So here's my code:

Code: Select all

[Variables]
NIC_ID=0016

[MeasureInterfaceGUID]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\#NIC_ID#
RegValue=NetCfgInstanceId

[MeasureVPNNameServer]
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
IfMatch=#VPNNameServer#
IfMatchAction=!SetVariable VPNNameServer [MeasureVPNNameServer]
DynamicVariables=1
The two problems being that the [MeasureInterfaceGUID] in [MeasureVPNNameServer] does not resolve to the correct location because when I comment it out with what it should be ({afdeecba-dfba-caff-5044-013412bceacd}) it gets the correct registry value.

Next I notice that if this registry value is left undefined (when the VPN is disconnected) it reads whatever is in that memory location, or at east that's what it looks like as the values in Open Log >> Skins >> MeasureVPNNameServer rotate through about 7 random different values (again only when VPN is disconnected it stays as one value when it is not). This is fine as I can use a regexp to make sure it's an IP address and then compare it against the IP in the variable however I can't get the #VPNNameServer# to resolve to the variable value (the IP) even if I manually enter it as the value I see in the registry. Does this make sense? If not I will try to reword.

Also I'm having a hard time with regexpressions but I want IfMatch to check if the value is an IP address and if it is to check against the IP in #VPNNameServer# variable would the following be the correct regexp? /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/|#VPNNameServer# I ask now because I don't want to come back and make another post after the previous issues have been ironed out, it would be nice to kind of ask about everything at once.

This also leads me to ask, and I doubt there is a way, but ideally I would like to avoid polling the registry often as this type of thing doesnt change often so it'd be nice to just have something execute when that value changes, kind of like a call back or something but thats not really possible is it?
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, 4:28 am

Code: Select all

IfMatch=#VPNNameServer#
IfMatchAction=!SetVariable VPNNameServer [MeasureVPNNameServer]
What are you actually trying to do here? Set a variable according to it's own value?

If the variable already matches the given measure, then why use setvariable?

And are you sure you don't have any special characters in the mentioned #VPNNameServer# {.,(,),[,],{,}}.
from the Realm of Death
User avatar
Yincognito
Rainmeter Sage
Posts: 7164
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 2nd, 2021, 4:28 amI have another issue, if anyone is still checking this thread and would like to help even more again greatly appreciate any and all help. [...]
0. Death.crafter is right with his 2nd question, make sure you clarify exactly the logic that he is referring to, and what you actually want to do.

1. Something along these lines should work (it works for me, except all my NameServer values are blank so I had to use the DhcpSubnetMask value for testing):

Code: Select all

[Variables]
NIC_ID=0016
VPNNameServer=255.0.0.0
...
...
...
[MeasureVPNNameServerVar]
Measure=String
String=#VPNNameServer#
UpdateDivider=-1

[MeasureInterfaceGUID]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\#NIC_ID#
RegValue=NetCfgInstanceId
UpdateDivider=-1
DynamicVariables=1

[MeasureVPNNameServer]
Measure=Registry
RegHKey=HKEY_LOCAL_MACHINE
RegKey=SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\[MeasureInterfaceGUID]
RegValue=NameServer
UpdateDivider=-1
IfMatch=^[MeasureVPNNameServerVar:EscapeRegExp]$
IfMatchAction=[!SetVariable MatchResult "Match"]
IfNotMatchAction=[!SetVariable MatchResult "Not Match"]
IfMatchMode=1
DynamicVariables=1
...
...
...
2. No need to "use a regexp to make sure it's an IP address and then compare it against the IP in the variable", just directly compare it against the variable, since that is also an IP I suppose, and it's actually your goal. The extra step is pointless, if I understood what you wanted properly.

3. Yes, the ^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$ is correct if we talk about the IPv4 addresses (different for IPv6 ones; I use a similar ^[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+$ for IPv4 and ^[^:]+:[^:]+:[^:]+:[^:]+:[^:]+:[^:]+:[^:]+:[^:]+$ for IPv6), notice the ^ and $ anchors for the start and end of the string. Brackets are unnecessary in an IfMatch as nothing is being captured and no indexes are being created there, plus, you wouldn't need to use (?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[MeasureVPNNameServerVar:EscapeRegExp]), notice the (?:) non-capturing group for OR conditionals and the :EscapeRegExp measure section variable's parameter, for the reason I stated above, not to mention that if you look closely this logical construct will match any IP, not just the VPNServer one.

4. The code above only polls the registry once, at skin refresh, due to the UpdateDivider=-1 option in the relevant measures. Because of that, this is suited for "on demand" execution and not periodic one. If you want a rare periodic one, just set the update divider to an integer (let's call it N) greater than 1, because doing so will only update the measures once every N times the value of the skin's ([Rainmeter] section's) Update option, in other words if you have Update=1000 in [Rainmeter] and UpdateDivider=3 in your measure, that measure is going to update once every 3 seconds. Yes, it's possible to "execute something" (some bangs, I guess?) when a measure value changed, by using the OnChangeAction option. There are a couple of catches with that though: it won't react the first time, as you can see in the manual, and would make using other more flexible ...Action options in the measure trickier, especially when trying to do them all "at the same time". Basically, what you choose depends on your scenario.
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 »

death.crafter wrote: August 2nd, 2021, 5:06 am What are you actually trying to do here? Set a variable according to it's own value?

If the variable already matches the given measure, then why use setvariable?

And are you sure you don't have any special characters in the mentioned #VPNNameServer# {.,(,),[,],{,}}.
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.

Also an IP address contains . so thats why Im using IfMatch to use the string and not the number of the value, do you think that's causing issues?

When the value is set there is no problem as it's an IP address however the issue is when the registry value is Not set, I believe when Rainmeter tries to read what's in a registry location that's not set it get's random garbage as it's just a memory location and reads whatever's in there until some terminating character. I could be wrong as I don't know exactly how the registry works it's just an assumption as when I look at the value of [MeasureVPNNameServer] I get the following values that just rotate between each other randomly.
regvalues.jpg
So essentially what I want to do is:
  • Read the memory location
    If the registry/memory location contains an IP address
    check if that IP is the same as it was the last time the registry value was polled
    If it is the same: Do nothing
    Else
    Update the variable #VPNNameServer# and refresh other aspects of the skin
You do not have the required permissions to view the files attached to this post.
LooseAllTheMonies
Posts: 14
Joined: July 29th, 2021, 6:52 am

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

Post by LooseAllTheMonies »

Yincognito wrote: August 2nd, 2021, 7:10 am 0. Death.crafter is right with his 2nd question, make sure you clarify exactly the logic that he is referring to, and what you actually want to do.
Right I addressed that it should actually be IfNotMatch but I was trying different things to try and debuf that's why it was posted that way.
Yincognito wrote: August 2nd, 2021, 7:10 am 2. No need to "use a regexp to make sure it's an IP address and then compare it against the IP in the variable", just directly compare it against the variable, since that is also an IP I suppose, and it's actually your goal. The extra step is pointless, if I understood what you wanted properly.
So the issue is its not ALWAYS an IP address only when it's defined as I posted in the post right above if the value isnt set the value seems to rotate between a set of random values so I have to check if it's an IP first.
These are the random values it contains when that value is NOT set.
regvalues.jpg
Yincognito wrote: August 2nd, 2021, 7:10 am 3. Yes, the ^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$ is correct if we talk about the IPv4 addresses (different for IPv6 ones; I use a similar ^[^\.]+\.[^\.]+\.[^\.]+\.[^\.]+$ for IPv4 and ^[^:]+:[^:]+:[^:]+:[^:]+:[^:]+:[^:]+:[^:]+:[^:]+$ for IPv6), notice the ^ and $ anchors for the start and end of the string. Brackets are unnecessary in an IfMatch as nothing is being captured and no indexes are being created there, plus, you wouldn't need to use (?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[MeasureVPNNameServerVar:EscapeRegExp]), notice the (?:) non-capturing group for OR conditionals and the :EscapeRegExp measure section variable's parameter, for the reason I stated above, not to mention that if you look closely this logical construct will match any IP, not just the VPNServer one.
Thanks for this I'm actually only interest in IPV4 as IPV6 isnt or doesnt appear to be used in this case or rather isnt that ubiquitous yet anyway. So would I have to make 2 measures? One to check if it's an IP and another to check if that IP is the same as #VPNNameServer#? I don't see any other way around it?
Again what I'm trying to do is:
Read the memory location
If the registry/memory location contains an IP address
check if that IP is the same as it was the last time the registry value was polled
If it is the same: Do nothing
Else
Update the variable #VPNNameServer# and refresh other aspects of the skin
Yincognito wrote: August 2nd, 2021, 7:10 am 4. The code above only polls the registry once, at skin refresh, due to the UpdateDivider=-1 option in the relevant measures. Because of that, this is suited for "on demand" execution and not periodic one. If you want a rare periodic one, just set the update divider to an integer (let's call it N) greater than 1, because doing so will only update the measures once every N times the value of the skin's ([Rainmeter] section's) Update option, in other words if you have Update=1000 in [Rainmeter] and UpdateDivider=3 in your measure, that measure is going to update once every 3 seconds. Yes, it's possible to "execute something" (some bangs, I guess?) when a measure value changed, by using the OnChangeAction option. There are a couple of catches with that though: it won't react the first time, as you can see in the manual, and would make using other more flexible ...Action options in the measure trickier, especially when trying to do them all "at the same time". Basically, what you choose depends on your scenario.
Yea iv'e removed this part as I noticed that.
You do not have the required permissions to view the files attached to this post.