It is currently August 8th, 2020, 6:25 am

Skin won't stay loaded

Help with creating, editing & fixing problems with skins
User avatar
arpeggiopaleggio
Posts: 5
Joined: July 24th, 2020, 6:33 pm
Location: UK

Skin won't stay loaded

Post by arpeggiopaleggio »

I've made a skin specifically for loading different layouts depending on whether the sun has set or not, and it works fine except it doesn't stay open and I'm not sure why. Once I load the skin, it changes the layout if needed and then closes itself immediately. Not sure what I've done wrong.

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Narbs=6732f6dbefc9ee817455ea2722f870ee0c10b45351d3050073aa3964697759db

[MeasureSun]
Measure=WebParser
URL=https://weather.com/en-GB/weather/today/l/#Narbs#
RegExp=(?siU)19.128a.75.75 0 0 0 0-1.5H3.167a.75.75 0 1 0 0 1.5H21z"></path></svg><p class="_-_-components-src-molecule-SunriseSunset-SunriseSunset--dateValue--3H780">(.*)</p>.*19.075a.75.75 0 1 0 0-1.5H3.167a.75.75 0 1 0 0 1.5H21z"></path></svg><p class="_-_-components-src-molecule-SunriseSunset-SunriseSunset--dateValue--3H780">(.*)</p>
UpdateRate=3600

[MeasureSunrise]
Measure=WebParser
URL=[MeasureSun]
StringIndex=1
Substitute=":":""

[MeasureSunset]
Measure=WebParser
URL=[MeasureSun]
StringIndex=2
Substitute=":":""

[MeasureMode]
Measure=Time
Format=%#H%M
IfCondition=(MeasureMode>[MeasureSunrise])&&(MeasureMode<[MeasureSunset])
IfTrueAction=[!LoadLayout "day"][!Update]
IfFalseAction=[!LoadLayout "night"][!Update]
DynamicVariables=1

[MeterDummy]
Meter=String
User avatar
jsmorley
Developer
Posts: 21217
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Skin won't stay loaded

Post by jsmorley »

You need to be sure that a version of this skin is included and loading in both layouts. Be SURE that for this skin in Layout "day" it is testing to see if it is now "night", and for this skin in Layout "night" it is testing for "day".

If you are not careful, you can easily get into an endless loop...
User avatar
balala
Rainmeter Sage
Posts: 11172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin won't stay loaded

Post by balala »

jsmorley wrote:
August 2nd, 2020, 6:15 pm
If you are not careful, you can easily get into an endless loop...
As far as I see the question, this definitely goes to an endless loop, unless the skin having the posted code is not included in any of the Night and Day layouts. If it's not, the skin has to be manually loaded and when the WebParser measures get their value, the skin loads the appropriate layout. If it is not included into the loaded layout, it's ok, but otherwise the discussed endless loop comes out. But this means that the skin has to be loaded manually from time to time, or there has to be another skin which loads this one for instance on certain moments of day.
Hope I don't miss something, but this is what I think about this thing.
User avatar
jsmorley
Developer
Posts: 21217
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Skin won't stay loaded

Post by jsmorley »

balala wrote:
August 2nd, 2020, 7:16 pm
As far as I see the question, this definitely goes to an endless loop, unless the skin having the posted code is not included in any of the Night and Day layouts. If it's not, the skin has to be manually loaded and when the WebParser measures get their value, the skin loads the appropriate layout. If it is not included into the loaded layout, it's ok, but otherwise the discussed endless loop comes out. But this means that the skin has to be loaded manually from time to time, or there has to be another skin which loads this one for instance on certain moments of day.
Hope I don't miss something, but this is what I think about this thing.
While I'm not in love with this approach, as I think it is a bit complicated to set up, and prone to problems if you want to change your layouts to load or unload skins or reposition something, I think it can work with some care.

You need two copies of this skin, what I will call the "testing" skins. One of them should be testing to see if it is "day", and that skin should be included and loaded in the Layout he creates for "night". The second one should be testing to see if it is "night", and that skin should be included and loaded in the Layout he creates for "day".

You want to avoid ever having the test cause a layout to be loaded that contains a running version of the same "testing" skin, as that is an endless loop... In other words, you can't ever allow a test that asks "is it night?" to load a layout that contains a test that asks "is it night?".
User avatar
balala
Rainmeter Sage
Posts: 11172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin won't stay loaded

Post by balala »

jsmorley wrote:
August 2nd, 2020, 7:24 pm
You need two copies of this skin, what I will call the "testing" skins. One of them should be testing to see if it is "day", and that skin should be included and loaded in the Layout he creates for "night". The second one should be testing to see if it is "night", and that skin should be included and loaded in the Layout he creates for "day".

You want to avoid ever having the test cause a layout to be loaded that contains a running version of the same "testing" skin, as that is an endless loop... In other words, you can't ever allow a test that asks "is it night?" to load a layout that contains a test that asks "is it night?".
Yes, agree, if there are those two, almost identical versions of the skin.