Hi,
I have a custom plugin skin for rainmeter that I've made with help from the tips and tricks section of the website but I want to make an If statement that uses the INTERNET_CONNECTIVITY preinstalled *thing* but I can't figure out how to make it display "Connected" if the INTERNET_CONNECTIVITY returns 1 and "Not Connected" if the INTERNET_CONNECTIVITY returns -1. Right now it works when I'm connected to the internet it displays "1" and when I'm not it displays -1. http://prntscr.com/5kbp54 This is a screenshow of it, and this is the code used: http://pastebin.com/dQBTDJjz Any advise on using If statements?
It is currently April 24th, 2024, 8:53 pm
Display whether connected to the internet or not
-
- Posts: 2
- Joined: December 24th, 2014, 1:08 am
Display whether connected to the internet or not
Last edited by jsmorley on December 24th, 2014, 1:50 am, edited 1 time in total.
Reason: Changed "plugin" to "skin" to avoid confusion.
Reason: Changed "plugin" to "skin" to avoid confusion.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Display whether connected to the internet or not
You could do something like this:
There are a couple of options for "if" testing of numbers.
http://docs.rainmeter.net/manual-beta/measures/general-options/ifactions
http://docs.rainmeter.net/manual-beta/measures/general-options/ifconditions
And based on the result, using http://docs.rainmeter.net/manual-beta/bangs#SetOption is often a good way to "react". Change some text, or the color of a font, or change an image to a skull and crossbones...
Code: Select all
[Rainmeter]
Update=10000
AccurateText=1
DynamicWindowSize=1
[MeasureLAN]
Measure=Plugin
Plugin=SysInfo
SysInfoType=LAN_CONNECTIVITY
[MeasureWAN]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
IfCondition=(MeasureLAN < 0)
IfTrueAction=[!SetOption MeterNetworkState Text "No Network"]
IfCondition2=(MeasureLAN > 0) && (MeasureWAN < 0)
IfTrueAction2=[!SetOption MeterNetworkState Text "No Internet"]
ifCondition3=(MeasureWAN > 0)
IfTrueAction3=[!SetOption MeterNetworkState Text "Connection OK"]
[MeterNetworkState]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=Checking...
http://docs.rainmeter.net/manual-beta/measures/general-options/ifactions
http://docs.rainmeter.net/manual-beta/measures/general-options/ifconditions
And based on the result, using http://docs.rainmeter.net/manual-beta/bangs#SetOption is often a good way to "react". Change some text, or the color of a font, or change an image to a skull and crossbones...
-
- Posts: 2
- Joined: December 24th, 2014, 1:08 am
Re: Display whether connected to the internet or not
Ok, now how do you display the "MeterNetworkState" *thing* that you used with !SetOption? Also, is there a way to color it like say, green when it's "connected" and set it red when it's "disconnected"?
Thanks for your help,
Matt
Thanks for your help,
Matt
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Display whether connected to the internet or not
MeterNetworkState is just a String meter that is at the bottom of the code. That is what the skin will display. We can use !SetOption to change various options of that String meter.
Code: Select all
[Rainmeter]
Update=10000
AccurateText=1
DynamicWindowSize=1
[MeasureLAN]
Measure=Plugin
Plugin=SysInfo
SysInfoType=LAN_CONNECTIVITY
[MeasureWAN]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
IfCondition=(MeasureLAN < 0)
IfTrueAction=[!SetOption MeterNetworkState Text "No Network"][!SetOption MeterNetworkState FontColor 255,0,0,255]
IfCondition2=(MeasureLAN > 0) && (MeasureWAN < 0)
IfTrueAction2=[!SetOption MeterNetworkState Text "No Internet"][!SetOption MeterNetworkState FontColor 255,0,0,255]
ifCondition3=(MeasureWAN > 0)
IfTrueAction3=[!SetOption MeterNetworkState Text "Connection OK"][!SetOption MeterNetworkState FontColor 0,255,0,255]
[MeterNetworkState]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
Text=Checking...