The purpose of this skin is to display the current IP and its location.
Also makes not (via color) if the VPN is not active.
All single states are functioning correctly. However when the IP changes it does not update unless you do a refresh.
I think what is happening is there is a period of a couple seconds where rainmeter thinks it is online but it isn't and webparser is doing that thing where it gets all confused. That's my guess. Several of these routines at the bottom were an attempt to get around this.
Weirdly in the second to last routine when written as Match or NotMatch it does not trigger.
Lastly this can be tested without a VPN simply by interrupting the internet. When restored it will remain without data.
And lastly lastly, the overuse of dynamicvariables=1 and IfMatchMode=1 is just how I debug. The removable ones will be removed after it works.
Thanks for your time.
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
MiddleMouseDownAction=!RainmeterDeactivateConfig
Group=RackMaster
[Metadata]
Name=IP
Author=Codger
Information=My system changes it's location at random intervals. This skin is to display my current location. It also displays a warning if the VPN goes down.
Version=0.0.4
License=License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0
[Variables]
; Static Variables
BackPadding=15
BarWidth=330
BackColor=25,25,25,200
BackBorder=255,255,0,50
PureRed=255,0,0
PureWhite=255,255,255
FontFace=Microsoft Sans Serif
FontColor=#PureWhite#,240
FontSize=10
BackHeight=53
OfflineColor=255,210,0
WarningColor=255,100,0
;-- Location of External IP
IPLocationSite="http://ipinfo.io/"
;-- IP to continuously Ping
PingSite=8.8.4.4
;---
; dynamic variables
IPlast=XXX.XXX.XXX.XXX
OnlineStatusLast=Unknown
[Background]
Meter=Shape
Shape=Rectangle 0,0,(#BarWidth# + (#BackPadding#*2) + 1),#BackHeight# | Fill Color #BackColor# | StrokeWidth 1 | Stroke Color #BackBorder#
UpdateDivider=-1
;
;
;Ping > 0 means truly online
[DetectInternet]
; Offline
; Online
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
SysInfoData=Best
Substitute="-1":"Offline", "1":"Online"
; Location
[MeasureWebParseLocation]
Measure=Plugin
Plugin=WebParser
URL=#IPLocationSite#
RegExp="(?siU)<h1 id="heading">(.*)</h1>.*<td>City</td>.*<a class=".*" href=".*"></a>(.*)</td>.*</tr>.*<tr>.*<td>Latitude/Longitude</td>.*<td data-loc=".*,.*">.*,.*</td>.*</tr>.*(?(?=.*<tr>.*<td>Postal).*<td>Postal Code</td>.*<td>(.*)</td>.*</tr>).*</table>"
OnChangeAction=[!UpdateMeasure "MeasureIP"][!UpdateMeasure "MeasureLocation"][!UpdateMeasure "MeasurePostalCode"]
DynamicVariables=1
UpdateRate=1
UpdateDivider=-1
[MeasureIP]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWebParseLocation]
StringIndex=1
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="^\s+":""
UpdateDivider=-1
[MeasureLocation]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWebParseLocation]
StringIndex=2
DecodeCharacterReference=1
RegExpSubstitute=1
Substitute="^\s+":""
UpdateDivider=-1
[MeasurePostalCode]
Measure=Plugin
Plugin=WebParser
URL=[MeasureWebParseLocation]
StringIndex=3
UpdateDivider=-1
[MeterIP]
Meter=String
MeasureName=MeasureIP
X=#BackPadding#
Y=3
FontSize=#FontSize#
StringStyle=Bold
FontColor=#PureWhite#
Text="Ext IP: %1"
DynamicVariables=1
[MeterInternetStatus]
Meter=String
MeasureName=DetectInternet
X=(#BarWidth#+#BackPadding#)
Y=3
MeterStyle=MeterIP
StringAlign=Right
InlineSetting=Color | #OfflineColor#
InlinePattern=Offline
Text="Status: %1"
DynamicVariables=1
Hidden=0
[MeterLocation]
Meter=String
MeasureName=MeasureLocation
Y=2R
MeterStyle=MeterIP
Text="%1 "
DynamicVariables=1
[MeterPostalCode]
Meter=String
MeasureName=MeasurePostalCode
Y=16r
MeterStyle=MeterIP
Text="Zip Code: %1"
DynamicVariables=1
[SetWarningColor]
Measure=String
String=[MeasurePostalCode]
IfMatch=02346|02347
IfMatchAction=[!SetOption MeterIP FontColor #WarningColor#]
IfNotMatchAction=[!SetOption MeterIP FontColor #PureWhite#]
DynamicVariables=1
;
;
; Update Everything on Switch in Online/Offline Status
; This Section Should Remain Last
;
[ReallyOnline]
; Offline = 0
; Blocked = 0
; Limited = 0
; Online > 0
Measure=Plugin
Plugin=PingPlugin
DestAddress=#PingSite#
UpdateRate=3
[MeasureConnectionChangeActions]
Measure=String
String=[DetectInternet]
IfMatch=Online
IfMatchAction=[!ShowMeter "MeterIP"]
IfNotMatchAction=[!HideMeter "MeterIP"][!CommandMeasure "MeasureWebParseLocation" "Reset"]
IfMatchMode=1
DynamicVariables=1
UpdateDivider=-1
[MeasureConnectionChangeCheck]
Measure=String
String=[DetectInternet]
IfMatch=#OnlineStatusLast#
IfNotMatchAction=[!SetVariable OnlineStatusLast [DetectInternet]][!UpdateMeter "MeterInternetStatus"][!UpdateMeasure "MeasureConnectionChangeActions"][!UpdateMeasure "MeasureWebParseLocation"]
IfMatchAction=[!UpdateMeasure "DetectInternet"]
DynamicVariables=1
[ReloadLocation]
Measure=String
String=[MeasureIP]
IfMatch=""
IfMatchAction=[!SetOption MeterInternetStatus Text "Got Here"][!CommandMeasure "MeasureWebParseLocation" "Update"]
DynamicVariables=1
UpdateDivider=-1
[MeasureOnlineForLocationUpdate]
Measure=String
String=[ReallyOnline]
IfMatch="0"
IfNotMatchAction=[!UpdateMeasure "ReloadLocation"]
DynamicVariables=1