It is currently March 29th, 2024, 5:47 am

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

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

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

Post by balala »

makeitrain wrote: October 27th, 2019, 5:30 am It's not pretty; but it works.
No, it doesn't. Well, in fact it probably does, however when the IfAboveValue option has to be executed, you still get an error in the log (something like !SetVariable: Incorrect number of arguments (....ini)), because the [!SetVariable LoadingText ] is still not right. Rainmeter still doesn't know what to do with the empty space after Loading Text, even if that's an Alt-255. Quotes would still be needed.
Please check the log when you refresh the skin.
User avatar
makeitrain
Posts: 11
Joined: October 24th, 2019, 1:10 am

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

Post by makeitrain »

Interesting, I followed your advice.

I changed code to [!SetVariable LoadingText ""] and the skin displayed the MeasurePing value. Setting it back to the alt-255 character and it shows up blank with no error in the log. This is the only error in my log but it stops once connected to the internet.
PingPlugin.dll: Unable to get host by name (WXDataWeather\WXDataWeather.ini - [MeasurePing])
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

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

Post by Yincognito »

jsmorley wrote: October 24th, 2019, 12:50 pmThis will detect if you are connected to the internet:

Code: Select all

[MeasureInternet]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
UpdateDivider=5
DynamicVariables=1
IfCondition=MeasureInternet = 1
IfTrueAction=[!ShowFade]
IfFalseAction=[!Hide]
Just out of curiosity, is there a way to detect when you are actually connecting to the internet? I always turn on my computer with the internet off and subsequently connect to the internet once all things are loaded up or I get the time, so for an "instant" update of my weather/feeds skins after connecting I have to refresh them. Of course, the skins periodically refresh (I set it to once every hour), but it would be nice to detect when the connection actually takes place successfully and get all the data, instead of waiting for the automatic & periodical update I set them to use. I know I could decrease the update "rate" in the skins, but I would prefer not to.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

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

Post by jsmorley »

Yincognito wrote: October 28th, 2019, 3:21 pm Just out of curiosity, is there a way to detect when you are actually connecting to the internet? I always turn on my computer with the internet off and subsequently connect to the internet once all things are loaded up or I get the time, so for an "instant" update of my weather/feeds skins after connecting I have to refresh them. Of course, the skins periodically refresh (I set it to once every hour), but it would be nice to detect when the connection actually takes place successfully and get all the data, instead of waiting for the automatic & periodical update I set them to use. I know I could decrease the update "rate" in the skins, but I would prefer not to.
Depends on what you are going for I guess. Do you want to have your weather or other feed skins load when your computer starts, but just have them be hidden and quiet before the internet is connected, or do you want to only load them at all when there is an internet connection?

There are tons of ways to skin this cat, but maybe I'd have a small skin, it could be a little icon, or even just invisible, that does nothing but use SysInfo to watch for internet connectivity. If "false", it could unload any internet-based skins, and if "true" it could load them. I would have it always loaded and running itself of course, so if you lose connectivity, it can automatically unload all the other skins.

What you don't want to do is have any skin that is looking for internet connectivity "refresh" itself. That is an endless loop.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

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

Post by jsmorley »

Or something like this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeasureInternet]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
IfCondition=MeasureInternet = 1
IfTrueAction=[!EnableMeasure MeasureSite][!CommandMeasure MeasureSite "Update"]

[MeasureSite]
Measure=WebParser
URL=https://forum.rainmeter.net
RegExp=(?siU)<title>(.*)</title>
StringIndex=1
UpdateDivider=3600
Disabled=1
FinishAction=[!ShowMeterGroup "MyMeters"]

[MeterTitle]
Meter=String
Group=MyMeters
MeasureName=MeasureSite
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Hidden=1
The WebParser measure will be brought to life and forced to update the first time internet connectivity is "true", then normally once an hour after that.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

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

Post by Yincognito »

jsmorley wrote: October 28th, 2019, 4:07 pm Depends on what you are going for I guess. Do you want to have your weather or other feed skins load when your computer starts, but just have them be hidden and quiet before the internet is connected, or do you want to only load them at all when there is an internet connection?

There are tons of ways to skin this cat, but maybe I'd have a small skin, it could be a little icon, or even just invisible, that does nothing but use SysInfo to watch for internet connectivity. If "false", it could unload any internet-based skins, and if "true" it could load them. I would have it always loaded and running itself of course, so if you lose connectivity, it can automatically unload all the other skins.

What you don't want to do is have any skin that is looking for internet connectivity "refresh" itself. That is an endless loop.
I see - so it's still about decreasing the update rate (the SysInfo measure, in this case). Basically, I want the skins loaded, visible, but updating as soon as the internet is available (not necessarily wating for the 1h periodical update period to pass).

For example, assuming that the periodical skin update interval is 1h, that I turned on my computer at 01:00 PM and successfully connected to the internet at 01:10 PM, this would mean I have to wait for 50 more minutes (until 02:00 PM) to get the data (unless I refresh the skins, that is). I want to get the data sooner, say right after the internet is on at 01:10 PM. The following periodical update would then be 02:10 PM as a result, instead of 02:00 PM as it was before.

EDIT: Just saw your last post, it appears to be close to what I want (as per your explanation), but I'll have to check it out more throughly.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

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

Post by jsmorley »

Yincognito wrote: October 28th, 2019, 4:39 pm I see - so it's still about decreasing the update rate (the SysInfo measure, in this case). Basically, I want the skins loaded, visible, but updating as soon as the internet is available (not necessarily wating for the 1h periodical update period to pass).

For example, assuming that the periodical skin update interval is 1h, that I turned on my computer at 01:00 PM and successfully connected to the internet at 01:10 PM, this would mean I have to wait for 50 more minutes (until 02:00 PM) to get the data (unless I refresh the skins, that is). I want to get the data sooner, say right after the internet is on at 01:10 PM. The following periodical update would then be 02:10 PM as a result, instead of 02:00 PM as it was before.

EDIT: Just saw your last post, it appears to be close to what I want (as per your explanation), but I'll have to check it out more throughly.
I think it is more or less exactly what you are looking for. The one thing I will again caution is that you can't have a skin that checks internet connectivity "refresh" itself based on the test. That is a certain endless loop.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

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

Post by Yincognito »

jsmorley wrote: October 28th, 2019, 4:42 pm I think it is more or less exactly what you are looking for. The one thing I will again caution is that you can't have a skin that checks internet connectivity "refresh" itself based on the test. That is a certain endless loop.
Agreed. I'm never refreshing from the code anyway (only used to do it manually by right clicking on the skins), so that's not a problem. A more tricky thing would be to squeeze the process in my feeds skin, where I already have some condition based "updates". It's been a while since I wrote it, so I might have to remember it all, to merge the modifications properly... :D The weather skin won't have this kind of "issues" though.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

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

Post by balala »

Yincognito wrote: October 28th, 2019, 3:21 pm Of course, the skins periodically refresh (I set it to once every hour),
Why? I doubt this would be a good practice: https://forum.rainmeter.net/viewtopic.php?f=5&t=22739&p=120238&hilit=refresh+balala+destructive#p120238
Usually there is not needed to periodically refresh a skin. i don't see a reason for this and me at least definitely try to avoid a such behavior.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

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

Post by Yincognito »

balala wrote: October 28th, 2019, 6:18 pm Why? I doubt this would be a good practice: https://forum.rainmeter.net/viewtopic.php?f=5&t=22739&p=120238&hilit=refresh+balala+destructive#p120238
Usually there is not needed to periodically refresh a skin. i don't see a reason for this and me at least definitely try to avoid a such behavior.
Sorry, balala - just a typo. I meant "update" instead of "refresh". I realize now why jsmorley was giving his advice regarding the endless loop - if I only knew it was because of my typo... :D

As I said, it shows that it's been a while since I last wrote some skin code - I'm beginning to use wrong words for operations. Or maybe it was just because of typing in a hurry. Anyway, my point is that it was a misunderstanding. My fault. :oops:

P.S. The funny thing is that everywhere else (including later in the same post, LOL) I used the correct term of "updating". I guess that the "refresh" word was just a slip up on my part.
Last edited by Yincognito on October 28th, 2019, 6:43 pm, edited 2 times in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth