It is currently April 18th, 2024, 5:46 pm

Getting webparser to run on change

Get help with creating, editing & fixing problems with skins
User avatar
DanielPodo
Posts: 77
Joined: March 30th, 2016, 1:50 pm

Getting webparser to run on change

Post by DanielPodo »

Please see the code below for a simple skin.

Code: Select all

[Variables]
@include=#@#Styles.inc

; **********************************
; MEASURES 
; **********************************

[measureConnection]
Measure=Plugin
Plugin=SysInfo
SysInfoType=INTERNET_CONNECTIVITY
Substitute="-1":"No big","1":"Yes big","0":"Wait"

[measureDNS]
Measure=Plugin
Plugin=SysInfo
SysInfoType=DNS_SERVER
Substitute="":"N/A"
UpdateDivider=-1

[measureWAN]
Measure=Plugin
Plugin=WebParser
Url=http://www.tell-my-ip.com/index.html
RegExp=(?siU)<td.*>Your IP Address.*<td>(.*)</td>
StringIndex=1
Substitute="":"No connection"
UpdateRate=-1

; ----------------------------------
; METERS
; ----------------------------------

[meterConnectionIcon]
Meter=Image
MeasureName=measureConnection
ImagePath=#@#Images\Android icons\
W=50
Solidcolor=0,0,0,1
LeftMouseUpAction=[Shell:::{8E908FC9-BECC-40f6-915B-F4CA0E70D03D}]
DynamicVariables=1

[meterNetworkInfo]
Meter=String
MeasureName=measureDNS
MeasureName2=measureWAN
MeterStyle=SmallText
X=0R
Y=8
Text=%1#CRLF#%2
Now if I lose the internet, meterConnectionIcon and DNS part of meterNetworkInfo change accordinly (once the skin refreshes). However, the WAN IP part doesn't change. What's the best way of getting it to update? It seems measureConnection is reliable, but would an OnChange function suffice? I already tried it and it didn't work, so I'm guessing UpdateRate takes precendence?

Thanks all!
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Getting webparser to run on change

Post by balala »

Try to add an OnChangeAction=[!CommandMeasure "measureWAN" "Reset"] option to the [measureConnection] measure.
User avatar
DanielPodo
Posts: 77
Joined: March 30th, 2016, 1:50 pm

Re: Getting webparser to run on change

Post by DanielPodo »

balala wrote:Try to add an OnChangeAction=[!CommandMeasure "measureWAN" "Reset"] option to the [measureConnection] measure.
Hmm, odd. This worked when I disabled my ethernet...but it didn't work when I enabled it. I've no idea why that would happen, as on both accounts, the [measureConnection] measure changes.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Getting webparser to run on change

Post by balala »

DanielPodo wrote:Hmm, odd. This worked when I disabled my ethernet...but it didn't work when I enabled it. I've no idea why that would happen, as on both accounts, the [measureConnection] measure changes.
Yeah, you're right. Add to the previous OnChangeAction option the following bang: [!CommandMeasure "measureWAN" "Update"] (into the [measureConnection] measure). This way, you'll have the following option: OnChangeAction=[!CommandMeasure "measureWAN" "Reset"][!CommandMeasure "measureWAN" "Update"].
Merry Christmas.
User avatar
DanielPodo
Posts: 77
Joined: March 30th, 2016, 1:50 pm

Re: Getting webparser to run on change

Post by DanielPodo »

balala wrote:Yeah, you're right. Add to the previous OnChangeAction option the following bang: [!CommandMeasure "measureWAN" "Update"] (into the [measureConnection] measure). This way, you'll have the following option: OnChangeAction=[!CommandMeasure "measureWAN" "Reset"][!CommandMeasure "measureWAN" "Update"].
Merry Christmas.
Thanks! Now it works! Awesome.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Getting webparser to run on change

Post by balala »

Glad to help.