It is currently April 26th, 2024, 6:10 am

Can anyone help me figure out why variables arent displaying

Get help with creating, editing & fixing problems with skins
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 3rd, 2021, 8:27 pmI 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.
Forget Google, the Rainmeter manual has all you need: !Delay bang. Or, you can execute / update subsequent measures from the FinishAction of the WebParser measure, if that is the first in your sequence.
Last edited by Yincognito on August 3rd, 2021, 9:06 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
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 »

LooseAllTheMonies wrote: August 3rd, 2021, 8:27 pm

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.
Apart from Yncognito's reply about the !Delay bang, note that the posted [MeasureDelayThenUpdate] measure can't "execute" a dely, because:
  • It is disabled (due to the Disabled=1 option). A disabled measure doesn't check / execute the IfCondition and the relative IfTrueAction / IfFalseAction option, first being needed to be enabled. It can't be enabled by a bang into its own IfTrueAction option, because this option is never executed.
  • Even if enabled, the posted measure still will delay infinitally the execution, because you can't get increasing the #DelayCounter# variable more times (to reach 6). Once the condition becoming / being true, the IfTrueAction option is executed once, then never again, unless the condition becomes first false, then true again. However to can use it for a delay, you should add an IfConditionMode=1 option to the meter, which makes the condition to be evaluated and the appropriate IfTrueAction / IfFalseAction executed once on each update cycle. This way after six seconds the DelayCounter variable becomes equal to 6 and IfFalseAction is executed, leading to a dely.
Just like Yincognito, recommend the !Delay bang.
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: August 3rd, 2021, 9:02 pmJust like Yincognito, recommend the !Delay bang.
Yep, I mentioned this mainly because it was the easy choice, he incorrectly said that Rainmeter can't delay things natively, and I didn't look into the problem in detail, but now that I think of it, detecting internet connectivity through a measure like this (courtesy of jsmorley) might achieve what he wants as well, if that VPN switch also involves temporarily losing internet connectivity like he alluded to:

Code: Select all

[InternetStatus]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
UpdateDivider=SomeUpdateDivider
IfCondition=(InternetStatus=1)
IfTrueAction=...[!CommandMeasure SomeWebParserMeasure "Update"]...
Alternatively, he could try LAN_CONNECTIVITY (though I don't think this will be suited), or just out of curiosity check what other SysInfo types (e.g. GATEWAY_ADDRESS) yield and if he can use them for this purpose.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
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 »

Yincognito wrote: August 3rd, 2021, 9:36 pm Yep, I mentioned this mainly because it was the easy choice, he incorrectly said that Rainmeter can't delay things natively, and I didn't look into the problem in detail,
Me neither and my reply was related only to how the delay can be done, assumed that !Delay should work, however didn't check. Instead insisted on why the posted [MeasureDelayThenUpdate] measure doesn't and can't work.
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: August 4th, 2021, 11:06 am Me neither and my reply was related only to how the delay can be done, assumed that !Delay should work, however didn't check. Instead insisted on why the posted [MeasureDelayThenUpdate] measure doesn't and can't work.
For sure. You can't simulate a delay by attempting to do a "measure update loop", like I suspect he was trying to...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
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 »

Yincognito wrote: August 4th, 2021, 11:26 am For sure. You can't simulate a delay by attempting to do a "measure update loop", like I suspect he was trying to...
The procedure should work, only the measure had a few mistake, preventing it to delay. Fixed them in my reply.
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: August 4th, 2021, 11:35 am The procedure should work, only the measure had a few mistake, preventing it to delay. Fixed them in my reply.
Ah, you're right, now I see. I was under the impression that the measure was successively updating without any "delay", but I realize now that the update rate of 1s was the actual "delay", applied 6 times. My bad.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth