It is currently May 27th, 2020, 2:23 am

What is my local IP Address(es)

Get help with installing and using Rainmeter.
User avatar
JoBu
Posts: 280
Joined: February 16th, 2011, 12:46 am
Location: California

Re: What is my local IP Address(es)

Post by JoBu »

Not sure if you're still trying to solve this, but you can implement .vbs into rainmeter using the execute command.

I'm working on a skin that needs to parse variable text - my solution was to write a vbs and save it as a .txt file. I then wrote a .bat that runs off a rainmeter execute command that converts the txt to vbs, runs it and converts it back to a .txt file for future changes.

A little clunky, but it gets the job done. Hope it helps.

//JoBu
User avatar
gt57
Posts: 13
Joined: August 31st, 2009, 4:02 am

Re: What is my local IP Address(es)

Post by gt57 »

I, too, have several network adapters. I like to display my current valid IP address for whichever NIC is up (Wifi, Ethernet, dock, and even loopback). I am trying out a scheme where I automatically toggle through my adapters until I find one that does not start with 127, 169, or is empty. I then assume this is my currently active adapter and stop checking any other adapters. You can paste the code below into a new skin for testing.

[Rainmeter]
Update=1000

; Get the IP address
[MeasureIP]
Measure=Plugin
Plugin=Plugins\SysInfo.dll
SysInfoType=IP_ADDRESS
SysInfoData=[MeasureChangeNIC]
DynamicVariables=1
Group=MainMeasures

; Parse the IP address and keep the first octet, if empty assign to 127
[MeasureIPPrefix]
Measure=UpTime
Format=[MeasureIP]
RegExpSubstitute=1
Substitute="^(\d{0,3}).(\d{1,3}).(\d{1,3}).\d{1,3}$":"\1","":"127"
DynamicVariables=1

; Check the IP against the undesired list, If found, keep checking.
[MeasureCheckNICforChange]
Measure=Calc
Formula=([MeasureIPPrefix] = 169) ? 1 : (([MeasureIPPrefix] = 127) ? 1 : 0)
DynamicVariables=1

; Increment through all the NICs (0 -7), change the 7 to the highest NIC number you have
[MeasureChangeNIC]
Measure=Calc
Formula=(MeasureChangeNIC = 7) ? 0 : MeasureChangeNIC + MeasureCheckNICforChange
DynamicVariables=1

; Display the IP address
[MeterIP]
Meter=STRING
MeasureName=MeasureIP
Antialias=0
FontFace=Arial
FontColor=74,219,255,255
FontSize=16
StringAlign=Left
StringStyle=Normal
Text=IP Address: %1
axolotl_soft
Posts: 27
Joined: October 30th, 2013, 3:50 pm
Location: United States

Re: What is my local IP Address(es)

Post by axolotl_soft »

This is an old thread, but I wanted to compliment your clever solution, gt57. The LAN IP issue has been nagging me for a while and I was glad to find an answer.
StromKnight
Posts: 1
Joined: June 10th, 2015, 12:02 am

Re: What is my local IP Address(es)

Post by StromKnight »

Definitely an old thread but here's an update to the illustro Network.ini to include the local IP address as well with Rainmeter 3.3B.

Enjoy Peeps, and make sure to check the LocalIPsetting, I believe it goes off your local IP adapter.

Code: Select all

; Lines starting ; (semicolons) are commented out.
; That is, they do not affect the code and are here for demonstration purposes only.
; ----------------------------------

[Rainmeter]
; This section contains general settings that can be used to change how Rainmeter behaves.
Update=1000
Background=#@#Background.png
; #@# is equal to Rainmeter\Skins\illustro\@Resources
BackgroundMode=3
BackgroundMargins=0,34,0,14

[Metadata]
; Contains basic information of the skin.
Name=Network
Author=poiru
Information=Shows your IP address and network activity.
License=Creative Commons BY-NC-SA 3.0
Version=1.0.0

[Variables]
; Variables declared here can be used later on between two # characters (e.g. #MyVariable#).
fontName=Trebuchet MS
textSize=8
colorBar=235,170,0,255
colorText=255,255,255,205
maxDownload=10485760
MaxUpload=10485760
; Set maxDownload and maxUpload to your maximum download and upload speed in bits.
; To convert kilobits, megabits, kilobytes, and megabytes into bits, go to http://www.google.com
; and search for something like "10 megabytes in bits".

; ----------------------------------
; MEASURES return some kind of value
; ----------------------------------

[measureIP]
; This measure returns your IP. WebParser measures are relatively complicated. If you're a beginner with
; Rainmeter, take a look at some of the other illustro skins before modifying this one.
Measure=Plugin
Plugin=WebParser
Url=http://checkip.dyndns.org
UpdateRate=14400
RegExp=(?siU)Address: (.*)</body>
StringIndex=1
Substitute="":"N/A"
; Substitute works as follows: "A":"B" where A is a string to substitute and B is a string
; to substitute with. In this case, it substutes "" (i.e. empty) to N/A

; Get the IP address
[MeasureIPLan]
Measure=Plugin
Plugin=Plugins\SysInfo.dll
SysInfoType=IP_ADDRESS
SysInfoData=[MeasureChangeNIC]
DynamicVariables=1
Group=MainMeasures

; Parse the IP address and keep the first octet, if empty assign to 127
[MeasureIPPrefix]
Measure=UpTime
Format=[MeasureIP]
RegExpSubstitute=1
Substitute="^(\d{0,3}).(\d{1,3}).(\d{1,3}).\d{1,3}$":"\1","":"127"
DynamicVariables=1

; Check the IP against the undesired list, If found, keep checking.
[MeasureCheckNICforChange]
Measure=Calc
Formula=([MeasureIPPrefix] = 169) ? 1 : (([MeasureIPPrefix] = 127) ? 1 : 0)
DynamicVariables=1

; Increment through all the NICs (0 -7), change the 7 to the highest NIC number you have
[MeasureChangeNIC]
Measure=Calc
Formula=(MeasureChangeNIC = 7) ? 0 : MeasureChangeNIC + MeasureCheckNICforChange
DynamicVariables=1

[measureNetIn]
Measure=NetIn
NetInSpeed=#maxDownload#
; NetInSpeed must be set so your maximun download speed for the download bar to scale correctly

[measureNetOut]
Measure=NetOut
NetOutSpeed=#maxUpload#

; ----------------------------------
; STYLES are used to "centralize" options
; ----------------------------------

[styleTitle]
StringAlign=Center
StringCase=Upper
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontName#
FontSize=10
AntiAlias=1
ClipString=1

[styleLeftText]
StringAlign=Left
; Meters using styleLeftText will be left-aligned.
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleRightText]
StringAlign=Right
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleBar]
BarColor=#colorBar#
BarOrientation=HORIZONTAL
SolidColor=255,255,255,15

[styleSeperator]
SolidColor=255,255,255,15

; ----------------------------------
; METERS display images, text, bars, etc.
; ----------------------------------

[meterTitle]
Meter=String
MeterStyle=styleTitle
; Using MeterStyle=styleTitle will basically "copy" the
; contents of the [styleTitle] section here during runtime.
X=100
Y=12
W=190
H=18
Text=Network
; Even though the text is set to Network, Rainmeter will display
; it as NETWORK, because styleTitle contains StringCase=Upper.

[meterIPLabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=40
W=190
H=14
Text=IP Address

[meterIPValue]
Meter=String
MeterStyle=styleRightText
MeasureName=measureIP
X=200
Y=0r
; r stands for relative. In this case, the Y postition of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text=%1
; %1 stands for the value of MeasureName (measureIP in this case).


[meterSeperator]
Meter=Image
MeterStyle=styleSeperator
X=10
Y=52
W=190
H=1


[meterLocalIPLabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=60
W=190
H=14
Text=Local IP

[meterLocalIPValue]
[MeterIP]
Meter=String
MeterStyle=styleRightText
MeasureName=measureIPLan
X=200
Y=0r
; r stands for relative. In this case, the Y postition of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text=%1
 %1 stands for the value of MeasureName (measureIP in this case).

[meterUploadLabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=80
W=190
H=14
Text=Upload

[meterUploadValue]
Meter=String
MeterStyle=styleRightText
MeasureName=measureNetOut
X=200
Y=0r
W=190
H=14
Text=%1B/s
NumOfDecimals=1
AutoScale=1
; Because measureIP returns the current upload speed in bytes, we must use AutoScale=1 to
; automatically scale the value into a more readable figure.

[meterUploadBar]
Meter=Bar
MeterStyle=styleBar
MeasureName=measureNetOut
X=10
Y=72
W=190
H=1

[meterDownloadLabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=100
W=190
H=14
Text=Download

[meterDownloadValue]
Meter=String
MeterStyle=styleRightText
MeasureName=measureNetIn
X=200
Y=0r
W=190
H=14
Text=%1B/s
NumOfDecimals=1
AutoScale=1

[meterDownloadBar]
Meter=Bar
MeterStyle=styleBar
MeasureName=measureNetIn
X=10
Y=92
W=190
H=1
You do not have the required permissions to view the files attached to this post.
Last edited by Brian on June 10th, 2015, 2:10 am, edited 1 time in total.
Reason: Please use [code] tags.
o0oHAVOKo0o
Posts: 2
Joined: May 5th, 2020, 6:56 am

Re: What is my local IP Address(es)

Post by o0oHAVOKo0o »

How to check wifi connection?

Code: Select all

[MeasureIPwifi]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=http://checkip.dyndns.org
RegExp="(?siU)Address: (.*)</body>"
StringIndex=1
UpdateRate=-1
if connected, then display the IP Address. Else, display "Disconnected"?
Last edited by balala on May 5th, 2020, 8:03 am, edited 1 time in total.
Reason: Please use <code> tags whenever are you posting code snippets. It's the </> button.
User avatar
balala
Rainmeter Sage
Posts: 10605
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: What is my local IP Address(es)

Post by balala »

o0oHAVOKo0o wrote:
May 5th, 2020, 7:00 am
if connected, then display the IP Address. Else, display "Disconnected"?
I'd use a SysInfo plugin measure. This plugin has two values for the SysInfoType option used to check if the computer is connected to LAN, respectively to internet.
For instance the following measure returns 1 if the computer is connected to LAN and -1 if it's not:

Code: Select all

[MeasureLAN]
Measure=Plugin
Plugin=SysInfo
SysInfoType=LAN_CONNECTIVITY
(if you'd like to check internet connectivity, replace the SysInfoType=LAN_CONNECTIVITY option with SysInfoType=INTERNET_CONNECTIVITY)
Accordingly to the returned value you should show up the IP address if the computer is connected or the Disconnected string otherwise. An IfCondition can be used to decide:

Code: Select all

[MeasureLAN]
Measure=Plugin
Plugin=SysInfo
SysInfoType=LAN_CONNECTIVITY
IfCondition=(#CURRENTSECTION#>0)
IfTrueAction=[!EnableMeasure "MeasureIPwifi"][!CommandMeasure "MeasureIPwifi" "Update"][!SetOption MeterText Text "%1"][!UpdateMeter "MeterText"][!Redraw]
IfFalseAction=[!DisableMeasure "MeasureIPwifi"][!SetOption MeterText Text "Disconnected"][!UpdateMeter "MeterText"][!Redraw]
Note that the above IfFalseAction disables the [MeasureIPwifi] measure if the computer isn't connected and enables it otherwise.
And the [MeterText] String meter, which shows up the IP address or Disconnected:

Code: Select all

[MeterText]
Meter=String
MeasureName=MeasureIPwifi
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
User avatar
Yincognito
Posts: 1639
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: What is my local IP Address(es)

Post by Yincognito »

o0oHAVOKo0o wrote:
May 5th, 2020, 7:00 am
How to check wifi connection?

Code: Select all

[MeasureIPwifi]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=http://checkip.dyndns.org
RegExp="(?siU)Address: (.*)</body>"
StringIndex=1
UpdateRate=-1
if connected, then display the IP Address. Else, display "Disconnected"?
If you only want to check the status / IP in the case of WiFi connection (but not if a wired connection is active), the code below is also an alternative:

Code: Select all

[Variables]

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255

---Measures---

[MeasureWiFiSSID]
Measure=Plugin
Plugin=WiFiStatus
WiFiInfoType=SSID
WiFiIntfID=0
UpdateDivider=-1
RegExpSubstitute=1
Substitute="(^$|^0$|^-1$)":"Disconnected"

[MeasureIPwifi]
Measure=WebParser
Url=http://checkip.dyndns.org
RegExp="(?siU)Address: (.*)</body>"
StringIndex=1
UpdateRate=-1
RegExpSubstitute=1
Substitute="(^$|^0$|^-1$)":"Disconnected"

[MeasureWiFiStatus]
Measure=String
String=[MeasureWiFiSSID], [MeasureIPwifi]
RegExpSubstitute=1
Substitute="^Disconnected, Disconnected$":"Disconnected","^.*, ":""
DynamicVariables=1

---Meters---

[MeterTest]
Meter=STRING
X=0
Y=0
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
MeasureName=MeasureWiFiStatus
Text="WiFi Status = %1"
DynamicVariables=1
This only checks things on skin refresh, due to the UpdateDivider=-1 and UpdateRate=-1 (the latter was present in your posted code, so I let it this way) in the corresponding measures. If you want to check it periodically, say every 5 minutes, you'd set UpdateDivider=5 in [MeasureWiFiSSID] and UpdateRate=300 (i.e. 5*60 sec) in [MeasureIPwifi], since the overall Update in the [Rainmeter] section is set to 1000 milliseconds (i.e. 1 second). Obviously, a change in the latter value requires a corresponding reevaluation of the UpdateDivider / UpdateRate values, to keep the update intervals of those two measures consistent / unchanged.
User avatar
balala
Rainmeter Sage
Posts: 10605
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: What is my local IP Address(es)

Post by balala »

Yincognito wrote:
May 6th, 2020, 12:42 pm
This only checks things on skin refresh, due to the UpdateDivider=-1 and UpdateRate=-1 (the latter was present in your posted code, so I let it this way) in the corresponding measures.
Take care that UpdateRate can't be negative. UpdateDivider yes, but UpdateRate not. Details: https://forum.rainmeter.net/viewtopic.php?f=5&t=33606&start=40#p166347.
User avatar
jsmorley
Developer
Posts: 20650
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: What is my local IP Address(es)

Post by jsmorley »

balala wrote:
May 6th, 2020, 3:32 pm
Take care that UpdateRate can't be negative. UpdateDivider yes, but UpdateRate not. Details: https://forum.rainmeter.net/viewtopic.php?f=5&t=33606&start=40#p166347.
Yes, if you use UpdateRate=-1 that doesn't do what UpdateDivider=-1 does. What it does is cause a weird "wrap around" of the number being used as the "counter" for threaded measures like WebParser and Ping, and what you actually get is UpdateRate=SomeGiganticNumber, I'm don't remember what it is, something like the largest integer size of a 16-bit integer in C. Big... In any case, for all practical purposes the behavior is sorta what you expect, as the measure will update once, then not again for 1,000 years or something, but I don't recommend it. I think it makes more sense, in all cases, to leave UpdateDivider alone on those measures. Leave it as the default "1". Then set UpdateRate to something sensible for the behavior you want, or UpdateRate=86400 or some other large number (that is the number of seconds in a day) if you want it to execute once and then stop.
User avatar
Yincognito
Posts: 1639
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: What is my local IP Address(es)

Post by Yincognito »

balala wrote:
May 6th, 2020, 3:32 pm

Take care that UpdateRate can't be negative. UpdateDivider yes, but UpdateRate not. Details: https://forum.rainmeter.net/viewtopic.php?f=5&t=33606&start=40#p166347.
jsmorley wrote:
May 6th, 2020, 3:56 pm


Yes, if you use UpdateRate=-1 that doesn't do what UpdateDivider=-1 does. What it does is cause a weird "wrap around" of the number being used as the "counter" for threaded measures like WebParser and Ping, and what you actually get is UpdateRate=SomeGiganticNumber, I'm don't remember what it is, something like the largest integer size of a 16-bit integer in C. Big... In any case, for all practical purposes the behavior is sorta what you expect, as the measure will update once, then not again for 1,000 years or something, but I don't recommend it. I think it makes more sense, in all cases, to leave UpdateDivider alone on those measures. Leave it as the default "1". Then set UpdateRate to something sensible for the behavior you want, or UpdateRate=86400 or some other large number (that is the number of seconds in a day) if you want it to execute once and then stop.
Oops, didn't know that. I just used the value I saw in the already posted code, I figured there was a good reason for it to be set this way. Guess I was wrong then... :confused: