It is currently April 27th, 2024, 2:33 am

[Solved] WebParser Woes

Get help with creating, editing & fixing problems with skins
User avatar
THAC0
Posts: 2
Joined: July 4th, 2017, 4:08 pm

[Solved] WebParser Woes

Post by THAC0 »

Been fiddling with this for about a week now, decided to ask for help.
My skins shows my IP/Router IP and WAN IP.
I have it set to format the IPs so they line up.
The LAN and DNS IPs line up, but the WAN IP isn't playing ball.

DNS (and LAN) code looks like this:

Code: Select all

;--------------------------------------------------------------------------------
;DNS
;--------------------------------------------------------------------------------

[DNSIP]
Measure=Plugin
Plugin=SysInfo
SysInfoType=DNS_SERVER

[DNS01]
Measure=String
String=[DNSIP]
RegExpSubstitute=1
Substitute="^(\d{1,3})\.\d{1,3}\.\d{1,3}\.\d{1,3}$":"\1","^(\d{1})$":"  \1","^(\d{2})$":" \1"

[DNS02]
Measure=String
String=[DNSIP]
RegExpSubstitute=1
Substitute="^\d{1,3}\.(\d{1,3})\.\d{1,3}\.\d{1,3}$":"\1","^(\d{1})$":"  \1","^(\d{2})$":" \1"

[DNS03]
Measure=String
String=[DNSIP]
RegExpSubstitute=1
Substitute="^\d{1,3}\.\d{1,3}\.(\d{1,3})\.\d{1,3}$":"\1","^(\d{1})$":"  \1","^(\d{2})$":" \1"

[DNS04]
Measure=String
String=[DNSIP]
RegExpSubstitute=1
Substitute="^\d{1,3}\.\d{1,3}\.\d{1,3}\.(\d{1,3})$":"\1","^(\d{1})$":"  \1","^(\d{2})$":" \1"

[DNSText]
Meter=String
MeterStyle=meterStyle1
 MeasureName=DNS01
MeasureName2=DNS02
MeasureName3=DNS03
MeasureName4=DNS04
X=175
Y=85
AntiAlias=1
Text="  DNS: %1.%2.%3.%4"
WAN code looks like this:

Code: Select all

;--------------------------------------------------------------------------------
;WAN
;--------------------------------------------------------------------------------

[WANIP]
Measure=Plugin
Plugin=WebParser
URL=http://checkip.dyndns.org
RegExp="(?siU)<body>(.+)Address: (.+)</body>"
StringIndex=2
UpdateRate=1800

[WAN01]
Measure=String
String=[WANIP]
RegExpSubstitute=1
Substitute="^(\d{1,3})\.\d{1,3}\.\d{1,3}\.\d{1,3}$":"\1","^(\d{1})$":"  \1","^(\d{2})$":" \1"

[WAN02]
Measure=String
String=[WANIP]
RegExpSubstitute=1
Substitute="^\d{1,3}\.(\d{1,3})\.\d{1,3}\.\d{1,3}$":"\1","^(\d{1})$":"  \1","^(\d{2})$":" \1"

[WAN03]
Measure=String
String=[WANIP]
RegExpSubstitute=1
Substitute="^\d{1,3}\.\d{1,3}\.(\d{1,3})\.\d{1,3}$":"\1","^(\d{1})$":"  \1","^(\d{2})$":" \1"

[WAN04]
Measure=String
String=[WANIP]
RegExpSubstitute=1
Substitute="^\d{1,3}\.\d{1,3}\.\d{1,3}\.(\d{1,3})$":"\1","^(\d{1})$":"  \1","^(\d{2})$":" \1"

[WANText]
Meter=String
MeterStyle=meterStyle1
 MeasureName=WAN01
MeasureName2=WAN02
MeasureName3=WAN03
MeasureName4=WAN04
X=10
Y=105
Text="  WAN: %1.%2.%3.%4"
Looking at the Rainmeter about box I can see the WAN IP is captured but it will not seem to parse it.
Can anyone throw some light on this?
Last edited by THAC0 on July 4th, 2017, 6:36 pm, edited 2 times in total.
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: WebParser Woes

Post by balala »

THAC0 wrote:The LAN and DNS IPs line up, but the WAN IP isn't playing ball.
Just add a DynamicVariables=1 option to the [WAN01] - [WAN04] measures.
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: WebParser Woes

Post by CyberTheWorm »

try changing your code for the 4 WAN parts to this, I did WAN01, seems to get the correct value

Code: Select all

[WAN01]
Measure=Plugin
Plugin=WebParser
URL=[WANIP]
RegExpSubstitute=1
Substitute="^(\d{1,3})\.\d{1,3}\.\d{1,3}\.\d{1,3}$":"\1","^(\d{1})$":"  \1","^(\d{2})$":" \1"
StringIndex=2
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
THAC0
Posts: 2
Joined: July 4th, 2017, 4:08 pm

Re: WebParser Woes

Post by THAC0 »

CyberTheWorm wrote:...
I already tried this, forgot to mention that.
balala wrote:Just add a DynamicVariables=1 option to the [WAN01] - [WAN04] measures.
I knew it would be something simple I had overlooked. Thank you very much, this fixed it.
User avatar
balala
Rainmeter Sage
Posts: 16174
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [Solved] WebParser Woes

Post by balala »

Glad to help.