Upon startup, a skin takes a while to load data from a weather website. So while the data is downloading I would like the skin to be hidden or the text size to be set to 0. The skin must not be hidden if a connection in the internet is lost, only at the start up and then unhidden after an internet connection has been established.
I thought about using Ping and !RainmeterSetVariable. Is there a simple way to do this or script already made?
Thank you
It is currently April 20th, 2024, 3:07 am
How to hide text or skin until internet connection is established?
-
- Posts: 11
- Joined: October 24th, 2019, 1:10 am
-
- Rainmeter Sage
- Posts: 16147
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: How to hide text or skin until internet connection is established?
To hide skin in the very first moment, add an appropriate bang into the OnRefreshaction option of the [Rainmeter] section:makeitrain wrote: ↑October 24th, 2019, 1:21 am Upon startup, a skin takes a while to load data from a weather website. So while the data is downloading I would like the skin to be hidden or the text size to be set to 0. The skin must not be hidden if a connection in the internet is lost, only at the start up and then unhidden after an internet connection has been established.
Code: Select all
[Rainmeter]
...
OnRefreshAction=[!Hide]
But to get it to reappear when the parsing is done, you'll need another bang. Add the following FinishAction option to the parent WebParser measure:
Code: Select all
[MeasureParentWebParser]
...
FinishAction=[!ShowFade]
Note that if there already is either an OnRefreshAction, or a FinishAction option, you have to add the above two bangs together with the existing ones.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: How to hide text or skin until internet connection is established?
Right. I would also point out that there are a couple of other ways to detect the network, and take action based on that.balala wrote: ↑October 24th, 2019, 12:40 pm To hide skin in the very first moment, add an appropriate bang into the OnRefreshaction option of the [Rainmeter] section:This bang hides the current skin when it is refreshed / loaded.Code: Select all
[Rainmeter] ... OnRefreshAction=[!Hide]
But to get it to reappear when the parsing is done, you'll need another bang. Add the following FinishAction option to the parent WebParser measure:When the measure finishes parsing the data, the FinishAction is executed, so its !ShowFade bang shows up the previously hidden skin.Code: Select all
[MeasureParentWebParser] ... FinishAction=[!ShowFade]
Note that if there already is either an OnRefreshAction, or a FinishAction option, you have to add the above two bangs together with the existing ones.
This will detect if you are connected to your local area network:
Code: Select all
[MeasureNetwork]
Measure=Plugin
Plugin=SysInfo
SysInfoType=LAN_CONNECTIVITY
UpdateDivider=5
DynamicVariables=1
IfCondition=MeasureNetWork = 1
IfTrueAction=[!ShowFade]
IfFalseAction=[!Hide]
Code: Select all
[MeasureInternet]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
UpdateDivider=5
DynamicVariables=1
IfCondition=MeasureInternet = 1
IfTrueAction=[!ShowFade]
IfFalseAction=[!Hide]
-
- Rainmeter Sage
- Posts: 16147
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: How to hide text or skin until internet connection is established?
Yes. But if I'm not wrong, makeitrain's computer is always conneted to internet, he just wanted to hide the skin while after refresh it didn't get the data yet.
-
- Posts: 11
- Joined: October 24th, 2019, 1:10 am
Re: How to hide text or skin until internet connection is established?
Wonderful! Thank you both for you input.
I will tinker with these ideas and implement it because my current code is a waste of resources; it is pinging to Google after the connection is established which is unnecessary.
I will tinker with these ideas and implement it because my current code is a waste of resources; it is pinging to Google after the connection is established which is unnecessary.
Code: Select all
[MeasurePing]
Measure=Plugin
Plugin=PingPlugin
DestAddress=www.google.com
UpdateRate=5
DynamicVariables=1
TimeoutValue=0
IfAboveValue=1
IfAboveAction=[!SetVariable LoadingText ][!SetVariable FontSizeAll 10][!Redraw][!UpdateMeter *]
IfEqualValue=0
IfEqualAction=[!Redraw][!UpdateMeter *]
[MeterPing]
Meter=String
MeasureName=MeasurePing
DynamicVariables=1
X=5
Y=5
W=200
H=20
FontColor=255,255,255,140
FontFace=#FontAll#
Text=#LoadingText#
FontSize=10
AntiAlias=1
-
- Rainmeter Sage
- Posts: 16147
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: How to hide text or skin until internet connection is established?
Yep, it indeed seems more or less useless.makeitrain wrote: ↑October 25th, 2019, 12:02 am I will tinker with these ideas and implement it because my current code is a waste of resources; it is pinging to Google after the connection is established which is unnecessary.
And beside this, note that there is a small mistake in the posted code: the [!SetVariable LoadingText ] bang of the IfAboveAction option of the [MeasurePing] measure doesn't work, when you load / refresh the skin, you get a !SetVariable: Incorrect number of arguments (....ini) error message in the log. This because when using the !SetVariable bang, you have to specify the value which you want to set to the variable. You can't simply leave empty the second parameter of the bang. If you want to set the variable empty, quotation mark is needed: [!SetVariable LoadingText ""]. These quotation marks tell the bang to set the variable empty.
-
- Posts: 11
- Joined: October 24th, 2019, 1:10 am
Re: How to hide text or skin until internet connection is established?
It's actually an alt-255 character; hence it appears empty. Although using some inverted commas could be useful too! Thank you again.balala wrote: ↑October 25th, 2019, 3:48 pm Yep, it indeed seems more or less useless.
And beside this, note that there is a small mistake in the posted code: the [!SetVariable LoadingText ] bang of the IfAboveAction option of the [MeasurePing] measure doesn't work, when you load / refresh the skin, you get a !SetVariable: Incorrect number of arguments (....ini) error message in the log.
-
- Posts: 11
- Joined: October 24th, 2019, 1:10 am
Re: How to hide text or skin until internet connection is established?
There's a question about this if I may; how does SysInfoType=INTERNET_CONNECTIVITY detect internet connection? Is it similar to ping? Many thanksjsmorley wrote: ↑October 24th, 2019, 12:50 pm This 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]
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: How to hide text or skin until internet connection is established?
It uses an internal Windows "Network Aware" API, which is what Windows uses itself to detect internet connectivity to display in the Notification Area. I think it creates a network socket to a particular service hosted by Microsoft and checks for success.makeitrain wrote: ↑October 26th, 2019, 3:15 am There's a question about this if I may; how does SysInfoType=INTERNET_CONNECTIVITY detect internet connection? Is it similar to ping? Many thanks
-
- Posts: 11
- Joined: October 24th, 2019, 1:10 am
Re: How to hide text or skin until internet connection is established?
You're right. This code only shows data if there's an active internet connection.
I am saving resources by modifying my current code slightly. It's not pretty; but it works.
Code: Select all
[MeasurePing]
Measure=Plugin
Plugin=PingPlugin
DestAddress=www.google.com
UpdateRate=#RefreshForever#
DynamicVariables=1
TimeoutValue=0
IfAboveValue=1
IfAboveAction=[!SetVariable RefreshForever 999999999][!SetVariable LoadingText ][!SetVariable FontSizeAll 10][!Redraw][!UpdateMeter *]
IfEqualValue=0
IfEqualAction=[!SetVariable RefreshForever 2][!Redraw][!UpdateMeter *]
Last edited by makeitrain on October 28th, 2019, 12:10 am, edited 1 time in total.