It is currently December 15th, 2019, 6:34 am

How to hide text or skin until internet connection is established?

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

Re: How to hide text or skin until internet connection is established?

balala » October 28th, 2019, 6:42 pm

Yincognito wrote:
October 28th, 2019, 6:32 pm
Sorry, balala - just a typo. I meant "update" instead of "refresh".
It happens sometimes (maybe even many times), however I still see a problem. You said:
Yincognito wrote:
October 28th, 2019, 3:21 pm
Of course, the skins periodically refresh (I set it to once every hour),
But one update per hour is extraordinary long. Usually the skins are updated once per second (if they have set the default Update=1000 within the [Rainmeter] section). Updating it once per hour makes practically the skin useless. If it does anything once per hour... Well, I can't imagine a reason to use a such skin...
Yincognito
Posts: 684
Joined: February 27th, 2015, 2:38 pm

Re: How to hide text or skin until internet connection is established?

Yincognito » October 28th, 2019, 7:00 pm

balala wrote:
October 28th, 2019, 6:42 pm
But one update per hour is extraordinary long. Usually the skins are updated once per second (if they have set the default Update=1000 within the [Rainmeter] section). Updating it once per hour makes practically the skin useless. If it does anything once per hour... Well, I can't imagine a reason to use a such skin...
Not exactly. This update period is only when talking about the weather and the feeds skins, as the rest of them (obviously) update much more frequently. For the weather, I see no reason of checking it more often than 1h, it's not like I'm looking for a particular lightning showing up, you know. In the case of the feeds skin, since my skin is practically an aggregator of feeds, 1h is just about the right period for one "ticker style slide" of all the agrregated feeds (20 feed items from 6 feed sources) at the (carefully chosen, in visual terms) current speed, so again it's optimal in my case.

That being said, all the different speed updates (short and long) that are used in my skins are easily adjustable, so it's not like they're hard-coded. The short update rates are used for regular skins like CPU, RAM, Processes, Network and such, while the "long" update rates are used for skins that don't need a fast update cycle, like weather, feeds, and the system info skin that barely needs updating to be honest (I mean, it's not like the current OS is changing every second or minute, right?)...

So, after having said the above, would you still think the 1h update "rate" is too long?
User avatar
balala
Rainmeter Sage
Posts: 9267
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to hide text or skin until internet connection is established?

balala » October 28th, 2019, 7:13 pm

Yincognito wrote:
October 28th, 2019, 7:00 pm
So, after having said the above, would you still think the 1h update "rate" is too long?
Well, even those skins are probably updated once per second. What is updated much more rarely, are the parent WebParser measures, which probably are indeed updated once per hour.
And no, those measures indeed haven't have to be updated much more frequently. Maybe you could reduce it to half hour or something like this, but one hour is a perfectly good choice, if you want it so.
Yincognito
Posts: 684
Joined: February 27th, 2015, 2:38 pm

Re: How to hide text or skin until internet connection is established?

Yincognito » October 28th, 2019, 7:37 pm

balala wrote:
October 28th, 2019, 7:13 pm
What is updated much more rarely, are the parent WebParser measures, which probably are indeed updated once per hour.
Indeed. Especially in the case of the feeds skin, which handles a substantial amount of data (and uses a bit more CPU in the few seconds it takes to aggregate the whole lot), I looked to avoid too frequent polling and go easy on the CPU as well (since the "slide" also takes a modest 1% CPU usage). After all, the editors of the online media also need a couple of minutes to write their news/stories. Except for the live sports bits, but in this case I'd rather watch the match instead of reading "live" feeds about the game anyway.

Other users can adjust these rates to their liking - it's only 2 or 3 clicks away in the settings skin. The defaults I'm using are suited for most of the "reasonable" scenarios - after all, I have no way of knowing if the user will read only 50 feed items or 200, so I had to balance things up when choosing the defaults.
User avatar
balala
Rainmeter Sage
Posts: 9267
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to hide text or skin until internet connection is established?

balala » October 28th, 2019, 8:00 pm

Yincognito wrote:
October 28th, 2019, 7:37 pm
Other users can adjust these rates to their liking - it's only 2 or 3 clicks away in the settings skin. The defaults I'm using are suited for most of the "reasonable" scenarios - after all, I have no way of knowing if the user will read only 50 feed items or 200, so I had to balance things up when choosing the defaults.
I don't think going upper then one hour would be useful. Updating the measures once per every hour might be satisfactorily, however more then this, well, would be too much.
Yincognito
Posts: 684
Joined: February 27th, 2015, 2:38 pm

Re: How to hide text or skin until internet connection is established?

Yincognito » October 28th, 2019, 10:24 pm

balala wrote:
October 28th, 2019, 8:00 pm
I don't think going upper then one hour would be useful. Updating the measures once per every hour might be satisfactorily, however more then this, well, would be too much.
My thoughts exactly. More than 1h would be too much for me as well.
User avatar
balala
Rainmeter Sage
Posts: 9267
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to hide text or skin until internet connection is established?

balala » October 29th, 2019, 7:32 am

Yincognito wrote:
October 28th, 2019, 10:24 pm
My thoughts exactly. More than 1h would be too much for me as well.
Yep, I can't imagine a situation to need a higher update rate then one hour for a WebParser measure. Not too practical I think. Might be, but in very rare situations.
User avatar
makeitrain
Posts: 11
Joined: October 24th, 2019, 1:10 am

Re: How to hide text or skin until internet connection is established?

makeitrain » November 3rd, 2019, 7:56 am

This is the code I decided to use because it works for the purpose I was intending. Open to better alternatives.

The code checks for internet connectivity and changes various variables to hide/unhide text upon connecting to the internet after startup. Once a connection is established it will not hide text even if there's no internet connection. Useful for some weather checking plugins.

Please note the space after !SetVariable LoadingText is the character ALT-255 which is blank character not a traditional space.

Code: Select all

[MeasurePing]
Measure=Plugin
Plugin=PingPlugin
DestAddress=www.google.com
UpdateRate=#RefreshForever#
DynamicVariables=1
TimeoutValue=0
IfAboveValue=1
IfAboveAction=[!SetVariable RefreshForever 99999999][!SetVariable LoadingText  ][!SetVariable FontSizeAll 10][!Redraw][!UpdateMeter *]
IfEqualValue=0
IfEqualAction=[!SetVariable RefreshForever 2][!Redraw][!UpdateMeter *]
User avatar
balala
Rainmeter Sage
Posts: 9267
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to hide text or skin until internet connection is established?

balala » November 3rd, 2019, 7:52 pm

makeitrain wrote:
November 3rd, 2019, 7:56 am
Please note the space after !SetVariable LoadingText is the character ALT-255 which is blank character not a traditional space.
Yes, but even so it is better to be included into quotations. In fact it always is better to use those quotations around the values set through bangs. Details: https://forum.rainmeter.net/viewtopic.php?f=5&t=26350&p=137628&hilit=quote+enclose+option#p137628
Yincognito
Posts: 684
Joined: February 27th, 2015, 2:38 pm

Re: How to hide text or skin until internet connection is established?

Yincognito » November 3rd, 2019, 8:47 pm

Completely agree with balala here - properly delimiting your string helps both you and Rainmeter, and prevents things being interpreted incorrectly on occasion. In fact, I often do the same with numerical variables, enclosing them in parentheses (i.e. ( and ), as in SomeValue=(#SomeVariable#)), in case I rewrite that part later on and the variable becomes part of a formula (which needs the parentheses to be interpreted as such).