It is currently April 26th, 2024, 7:33 am

Manage UTC time

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Manage UTC time

Post by balala »

brax64 wrote: September 3rd, 2020, 3:04 pm unfortunately another major problem arises so I can't verify if it's working properly, I'm getting this error now:
(Fetch error) The operation timed out (ErrorCode=12002) (SpotPrices\SpotPrices.ini - [Site])
even if I remove the [Counter] measure...
First of all try restarting Rainmeter. I mean a complet restart: right click it's icon in the Notification Area, click Exit, then restart it. WebParser measures tend to hang themselves when you're refreshing repetatly the skin and such in a case, the only way to get them working again, is a complet restart of Rainmeter. Details: https://forum.rainmeter.net/viewtopic.php?f=5&t=26117&p=136507&p136507#p136507
Did this fix the issue? If it didn't, I'd need the content of the @Resources\Variables.inc file, since it probably stores a few needed variables (for instance and most important, the URL variable.)
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: Manage UTC time

Post by brax64 »

balala wrote: September 3rd, 2020, 3:26 pm First of all try restarting Rainmeter. I mean a complet restart...
Hi Balala,

Thanks, restarting Rainmeter did the trick; so I verified if the "10 minutes" option works but it doesn't, the skin update every 10 minutes but from the time it has been loaded, not at the 10th minute mark of the hour..., the skin is not updating at all...
Also, if you can, I would like if you have a look at the measure [GoldTick], I'm not sure it's working properly... it seems that randomly fails to update the variable #GoldPricePrevious# maybe there's a better way to implement it...
here is the whole skin:

SpotPrices_1.1.rmskin
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Manage UTC time

Post by balala »

brax64 wrote: September 3rd, 2020, 3:51 pm Thanks, restarting Rainmeter did the trick;
I'm glad.
brax64 wrote: September 3rd, 2020, 3:51 pm the skin is not updating at all...
But yes, it does.
However there is a terms confusion you make: the skin itself updates once per second, due to its Update=1000 option, posted into the [Rainmeter] section.
Updating the parent WebParser measure on the other hand (in this case the [Site] measure) is a completely different thing. How often this goes on, is controled by the UpdateRate x UpdateDivider value. Since here UpdateRate is set to 600 (10 minutes) and the UpdateDivider to -1, the measure is never updated. Its update should have to be controled by the !CommandMeasure bang posted into the IfTrueAction option of the [Counter] measure. But it isn't and this due to the UpdateDivider=-1 option set on the [Site] measure (It seems this value is causing an update problem - there has been a warning about this a while ago on the forum - will look for it). Remove it and if you want to not update the measure, set its UpdateRate to -1 (UpdateRate=-1 instead of UpdateRate=#UpdateRate#). This way you'll get the measure updated ONLY when the value of the [Counter] measure is zero.
brax64 wrote: September 3rd, 2020, 3:51 pm Also, if you can, I would like if you have a look at the measure [GoldTick], I'm not sure it's working properly... it seems that randomly fails to update the variable #GoldPricePrevious# maybe there's a better way to implement it...
Ok, I'm gonna take a look immediately.
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Manage UTC time

Post by balala »

brax64 wrote: September 3rd, 2020, 3:51 pm Also, if you can, I would like if you have a look at the measure [GoldTick], I'm not sure it's working properly... it seems that randomly fails to update the variable #GoldPricePrevious# maybe there's a better way to implement it...
here is the whole skin:
It does work and as usual, it does what is intended to do. When the [GoldTick] measure is enabled (by the first bang of the FinishAction option of the [Site] measure), one of its IfTrueAction options get executed. Since all of these options have a $SetVariable bang to set the value of the GoldPricePrevious variable to [GoldPriceNumber], the variable is set to this value and accordingly the [GoldTick] measure gets 0, being calculated as the difference between the [GoldPriceNumber] measure and the #GoldPricePrevious# variable (which coincide).
Unfortunately I don't know what should you do here to fix this, because I'm not sure about your intention.

Additional notes:
  • You don't need the & character into the [GoldPriceNumber] measure name into the Formula option of the [GoldTick] measure. This option should be simply Formula=([GoldPriceNumber]-#GoldPricePrevious#).
  • Recommend you to get used to use quotes around parameter of bangs. for instance it is extremely recommended to include into such quotes especially the name of the file where the !WriteKeyValue bangs should write their values. If you don't use those quotes, there will be no problem unless the path include spaces. But if it does, the writing will fail (and an error message will arise in the log). So for instance I'd write the [!WriteKeyValue Variables GoldPricePrevious [GoldPriceNumber] #@#Variables.inc] bang of the IfTrueAction option of the [GoldTick] measure as [!WriteKeyValue Variables GoldPricePrevious "[GoldPriceNumber]" "#@#Variables.inc"]. Note that beside adding the quotes around the file, I added them around the [GoldPriceNumber] parameter as well. This trick can avoid you a lot of headaches over time. Details: https://forum.rainmeter.net/viewtopic.php?f=5&t=27375&p=142041&p142041#p142041
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: Manage UTC time

Post by brax64 »

balala wrote: September 3rd, 2020, 8:06 pm It does work and as usual, it does what is intended to do. When the [GoldTick] measure is enabled (by the first bang of the FinishAction option of the [Site] measure), one of its IfTrueAction options get executed. Since all of these options have a $SetVariable bang to set the value of the GoldPricePrevious variable to [GoldPriceNumber], the variable is set to this value and accordingly the [GoldTick] measure gets 0, being calculated as the difference between the [GoldPriceNumber] measure and the #GoldPricePrevious# variable (which coincide).
Unfortunately I don't know what should you do here to fix this, because I'm not sure about your intention.
Tanks Balala for your time, really appreciated!

Yes, your interpretation is correct, this is the way I want it to work.
Observing the skin to work overtime though, I've noticed that, randomly, the variable #GoldPricePrevious# is not updated...
I mean after the execution of the IfCondition, I should have #GoldPricePrevious#=[GoldPrice] reflected in the Variables.inc files; so when the next cycle trigger I'll have the calculation done properly but, being the variable #GoldPricePrevious# not updated, the resulting calculation is not correct. Obviously no errors are generated because a calculation is anyway performed but the displayed [GoldTick] value trough the [Gold@] meter, is wrong...
This happens also in the identical measures that do the same calculation for the Silver, Platinum and Palladium...
balala wrote: September 3rd, 2020, 8:06 pm
Additional notes:
  • You don't need the & character into the [GoldPriceNumber] measure name into the Formula option of the [GoldTick] measure. This option should be simply Formula=([GoldPriceNumber]-#GoldPricePrevious#).
  • Recommend you to get used to use quotes around parameter of bangs. for instance it is extremely recommended to include into such quotes especially the name of the file where the !WriteKeyValue bangs should write their values. If you don't use those quotes, there will be no problem unless the path include spaces. But if it does, the writing will fail (and an error message will arise in the log). So for instance I'd write the [!WriteKeyValue Variables GoldPricePrevious [GoldPriceNumber] #@#Variables.inc] bang of the IfTrueAction option of the [GoldTick] measure as [!WriteKeyValue Variables GoldPricePrevious "[GoldPriceNumber]" "#@#Variables.inc"]. Note that beside adding the quotes around the file, I added them around the [GoldPriceNumber] parameter as well. This trick can avoid you a lot of headaches over time. Details: https://forum.rainmeter.net/viewtopic.php?f=5&t=27375&p=142041&p142041#p142041
Acknowledged! I'll apply immediately
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Manage UTC time

Post by balala »

brax64 wrote: September 3rd, 2020, 8:36 pm Observing the skin to work overtime though, I've noticed that, randomly, the variable #GoldPricePrevious# is not updated...
I mean after the execution of the IfCondition, I should have #GoldPricePrevious#=[GoldPrice] reflected in the Variables.inc files; so when the next cycle trigger I'll have the calculation done properly but, being the variable #GoldPricePrevious# not updated, the resulting calculation is not correct. Obviously no errors are generated because a calculation is anyway performed but the displayed [GoldTick] value trough the [Gold@] meter, is wrong...
This happens also in the identical measures that do the same calculation for the Silver, Platinum and Palladium...
Try to remove the UpdateDivider=-1 option from the [GoldTick] measure.
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: Manage UTC time

Post by brax64 »

balala wrote: September 3rd, 2020, 8:46 pm Try to remove the UpdateDivider=-1 option from the [GoldTick] measure.
I did, but in this way I get always "0" for the [GoldTick] measure and it's not what I want...
So basically this whole thing should work like this:
Parse the value for [GoldPrice] ---> compare it to #GoldPricePrevious# with the [GoldTick] measure ---> print the result with [Gold@] meter ---> store [GoldPrice] in Variables.inc
The next cycle will repeat with a NEW parsed [GoldPrice]...
Now if the variable #GoldPricePrevious# is not updated (and by my observation seems to happen randomly, sometimes it is updated properly and sometimes it is not...) the next compare operation will return a wrong result...

Code: Select all

[Site]
Measure=WebParser
URL=#URL#
UpdateRate=-1
Flags=Resync | NoCookies
UserAgent=#UserAgent#
LogSubstringErrors=0
RegExp=(?siU)^(.*)$
StringIndex=1
FinishAction=[!EnableMeasureGroup Child][Play "#@#Sounds\UpdateAlarm.wav"][!Delay 1000][!UpdateMeasureGroup Tick]

[SpotGold]
Measure=WebParser
URL=[Site]
StringIndex=1
RegExp=(?siU)^.*>Spot Gold </a>.*nowrap>(.*)</td>.*nowrap>(.*)</td>.*nowrap>(.*)%</td>.*right'>(.*)</td>.*right'>(.*)</td>.*right'>(.*)</td>
Disabled=1
Group=Child

[GoldPrice]
Measure=WebParser
URL=[SpotGold]
StringIndex=1

[GoldPriceNumber]
Measure=WebParser
URL=[SpotGold]
StringIndex=1
Substitute=",":""

[GoldTick]
Measure=Calc
Formula=([GoldPriceNumber]-#GoldPricePrevious#)
IfCondition=([GoldTick] > 0)
IfTrueAction=[!SetOption Gold@ FontColor #UpColor#][!UpdateMeter Gold@][!Redraw][!SetVariable GoldPricePrevious [GoldPriceNumber]][!WriteKeyValue Variables GoldPricePrevious "[GoldPriceNumber]" "#@#Variables.inc"]
IfCondition2=([GoldTick] = 0)
IfTrueAction2=[!SetOption Gold@ FontColor #Color2#][!UpdateMeter Gold@][!Redraw][!SetVariable GoldPricePrevious [GoldPriceNumber]][!WriteKeyValue Variables GoldPricePrevious "[GoldPriceNumber]" "#@#Variables.inc"]
IfCondition3=([GoldTick] < 0)
IfTrueAction3=[!SetOption Gold@ FontColor #DownColor#][!UpdateMeter Gold@][!Redraw][!SetVariable GoldPricePrevious [GoldPriceNumber]][!WriteKeyValue Variables GoldPricePrevious "[GoldPriceNumber]" "#@#Variables.inc"]
DynamicVariables=1
UpdateDivider=-1
Group=Child | Tick
Disabled=1

So something in the code above, for whatever reason that still elude me, is not doing its job correctly.... Not sure if it's a timing problem (that the reason for [!Delay 1000][!UpdateMeasureGroup Tick] but I've tried different Delay values with no luck though...)

EDIT - Proof of what happening:
Untitled.png
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Manage UTC time

Post by eclectic-tech »

brax64 wrote: September 3rd, 2020, 9:24 pm I did, but in this way I get always "0" for the [GoldTick] measure and it's not what I want...
So basically this whole thing should work like this:
Parse the value for [GoldPrice] ---> compare it to #GoldPricePrevious# with the [GoldTick] measure ---> print the result with [Gold@] meter ---> store [GoldPrice] in Variables.inc
The next cycle will repeat with a NEW parsed [GoldPrice]...
Now if the variable #GoldPricePrevious# is not updated (and by my observation seems to happen randomly, sometimes it is updated properly and sometimes it is not...) the next compare operation will return a wrong result...
...
So something in the code above, for whatever reason that still elude me, is not doing its job correctly.... Not sure if it's a timing problem (that the reason for [!Delay 1000][!UpdateMeasureGroup Tick] but I've tried different Delay values with no luck though...)
Add IfConditionMode=1 to [GoldTick] measure; conditions must change before being evaluated again. By setting IfConditionMode=1, the condition is evaluated on every update. Now if the condition remains the same twice, the action will still be taken.

Code: Select all

[GoldTick]
Measure=Calc
Formula=([GoldPriceNumber]-#GoldPricePrevious#)
IfCondition=([GoldTick] > 0)
IfTrueAction=[!SetOption Gold@ FontColor #UpColor#][!UpdateMeter Gold@][!Redraw][!SetVariable GoldPricePrevious [GoldPriceNumber]][!WriteKeyValue Variables GoldPricePrevious "[GoldPriceNumber]" "#@#Variables.inc"]
IfCondition2=([GoldTick] = 0)
IfTrueAction2=[!SetOption Gold@ FontColor #Color2#][!UpdateMeter Gold@][!Redraw][!SetVariable GoldPricePrevious [GoldPriceNumber]][!WriteKeyValue Variables GoldPricePrevious "[GoldPriceNumber]" "#@#Variables.inc"]
IfCondition3=([GoldTick] < 0)
IfTrueAction3=[!SetOption Gold@ FontColor #DownColor#][!UpdateMeter Gold@][!Redraw][!SetVariable GoldPricePrevious [GoldPriceNumber]][!WriteKeyValue Variables GoldPricePrevious "[GoldPriceNumber]" "#@#Variables.inc"]
IfConditionMode=1
DynamicVariables=1
UpdateDivider=-1
Group=Child | Tick
Disabled=1
Add IfConditionMode=1 to each of the other metals value evaluations.
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: Manage UTC time

Post by brax64 »

eclectic-tech wrote: September 4th, 2020, 2:04 am Add IfConditionMode=1 to [GoldTick] measure; conditions must change before being evaluated again. By setting IfConditionMode=1, the condition is evaluated on every update. Now if the condition remains the same twice, the action will still be taken.
...
Hi eclectic_tech,
Your suggestion is the solution, now the variables are updated properly.

Thank you very much!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Manage UTC time

Post by eclectic-tech »

:thumbup: