It is currently March 29th, 2024, 7:12 am

One Meter Updates !OnChangAction but another does not [solved]

Get help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

One Meter Updates !OnChangAction but another does not [solved]

Post by CodeCode »

So I have this basic skin that keeps track of my ip - I live in a rural area so my ip changes regularly.

I recently started to use a VPN.

This code is hat I am using with mixed results:

Code: Select all

[MeasureWANIP]
Measure=WebParser
Url=http://checkip.dyndns.org/%22
RegExp="(?siU)<body>(.+)Address: (.+)</body>"
StringIndex=2
OnChangeAction=[!SetOption MeterWANIP Text [MeasureWANIP]][!Redraw]
DynamicVariables=1

[MeterFrame]
Meter=Image
SolidColor=65,75,175,190
X=35
Y=35
W=260
H=260

[MeterWANIP]
Meter=String
MeasureName=MeasureWANIP
X=165
Y=132
StringAlign=Center
FontColor=200,200,200,255
StringEffect=Border
FontEffectColor=0,0,0,255
FontSize=18
FontFace=Calibri
AntiAlias=1
MouseOverAction=[!SetOption MeterWANIP FontColor 210,170,90,220][!UpdateMeterGroup IPN][!Redraw]
LeftMouseDownAction=["C:\Program Files\Private Internet Access\pia-client.exe"]
Text=%1
DynamicVariables=1
Group=IPN
This above part does not update instantl, and requires a manual refresh to reflect the new ip:


This part does:

Code: Select all

[MeasureAdapter]
Measure=Plugin
Plugin=SysInfo
SysInfoType=ADAPTER_DESCRIPTION
SysInfoData=Best
Substitute="Intel(R) Ethernet Connection (7) I218-IV":"STANDARD","Private Internet Access Network Adapter":"Private"
DynamicVariables=1

[MeterIfVPN]
Meter=String
MeasureName=MeasureAdapter
X=r
Y=+36r
Text=%1
StringAlign=Center
StringEffect=Border
FontEffectColor=0,0,0,255
FontColor=200,200,200,255
FontSize=19
FontFace=Calibri
AntiAlias=1
Is there a way to get this to update the ip text, and not just the adapter text?

The layout might seem messed up - I cut out some image meters from this text as they are not relevant - just ignore that part.
Last edited by CodeCode on September 13th, 2020, 6:23 am, edited 1 time in total.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: One Meter Updates !OnChangAction but another does not

Post by brax64 »

CodeCode wrote: September 13th, 2020, 3:58 am So I have this basic skin that keeps track of my ip - I live in a rural area so my ip changes regularly.
...
Hi CodeCode
Try to replace OnChangeAction=[!SetOption MeterWANIP Text [MeasureWANIP]][!Redraw]
with OnChangeAction=[!SetOption MeterWANIP Text [MeasureWANIP]][!UpdateMeter WANIP][!Redraw]
also I think the DynamicVariables=1 on the [MeasureWANIP] measure is not needed
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: One Meter Updates !OnChangAction but another does not

Post by CodeCode »

brax64 wrote: September 13th, 2020, 4:35 am Hi CodeCode
Try to replace OnChangeAction=[!SetOption MeterWANIP Text [MeasureWANIP]][!Redraw]
with OnChangeAction=[!SetOption MeterWANIP Text [MeasureWANIP]][!UpdateMeter WANIP][!Redraw]
also I think the DynamicVariables=1 on the [MeasureWANIP] measure is not needed
Hi brax64,
That did not make a difference.
Thanks for chiming in though. 8-)
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
brax64
Posts: 172
Joined: July 8th, 2018, 8:05 pm

Re: One Meter Updates !OnChangAction but another does not

Post by brax64 »

CodeCode wrote: September 13th, 2020, 4:46 am Hi brax64,
That did not make a difference.
Thanks for chiming in though. 8-)
Try to replace OnChangeAction with OnUpdateAction
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: One Meter Updates !OnChangAction but another does not

Post by CodeCode »

dvo wrote: September 13th, 2020, 4:10 am to sleepy going back to bed.. :D but i don't see the update any where ...
Hi dvo.
The skin has an update of the standard 1000 milliseconds.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: One Meter Updates !OnChangAction but another does not

Post by CodeCode »

dvo wrote: September 13th, 2020, 5:13 am https://forum.rainmeter.net/viewtopic.php?t=22186 this should be a pia version...
Hi dvo,

Both of those threads aim toward what I already have working = ADAPTER+TYPE updating correctly.

I am trying to have the IP_ADDRESS but the string is not updating the string that represents the IP number.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1363
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: One Meter Updates !OnChangAction but another does not

Post by CodeCode »

I got it working by adding another measure where the !Refresh works correctly.

Code: Select all

;New Measure
[MeasureIP]
Measure=Plugin
Plugin=SysInfo
SysInfoType=IP_ADDRESS
SysInfoData=Best
OnChangeAction=[!Refresh]
DynamicVariables=1

;Same Text Meter
[MeterWANIP]
Meter=String
MeasureName=MeasureWANIP
X=165
Y=132
StringAlign=Center
FontColor=#ColorZ#
StringEffect=Border
FontEffectColor=0,0,0,255
FontSize=18
FontFace=#Font#
AntiAlias=1
MouseOverAction=[!SetOption MeterWANIP FontColor 210,170,90,220][!Redraw]
LeftMouseDownAction=["C:\Program Files\Private Internet Access\pia-client.exe"]
Text=%1
DynamicVariables=1
Group=IPN
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: One Meter Updates !OnChangAction but another does not

Post by Yincognito »

CodeCode wrote: September 13th, 2020, 6:23 am I got it working by adding another measure where the !Refresh works correctly.

Code: Select all

;New Measure
[MeasureIP]
Measure=Plugin
Plugin=SysInfo
SysInfoType=IP_ADDRESS
SysInfoData=Best
OnChangeAction=[!Refresh]
DynamicVariables=1

;Same Text Meter
[MeterWANIP]
Meter=String
MeasureName=MeasureWANIP
X=165
Y=132
StringAlign=Center
FontColor=#ColorZ#
StringEffect=Border
FontEffectColor=0,0,0,255
FontSize=18
FontFace=#Font#
AntiAlias=1
MouseOverAction=[!SetOption MeterWANIP FontColor 210,170,90,220][!Redraw]
LeftMouseDownAction=["C:\Program Files\Private Internet Access\pia-client.exe"]
Text=%1
DynamicVariables=1
Group=IPN
You don't need !Refresh, you don't need OnChangeAction, you don't need any of that. In your previous code using an WebParser measure, you only needed to add a [!CommandMeasure MeasureWANIP "Update"] (followed by updating and redrawing the necessary meters, of course) wherever you wanted to update the IP (e.g. on mouse hover, on mouse click, etc). In the current code, there's no need for OnChangeAction=[!Refresh] in the measure, it should update automatically, assuming you actually reference the [MeasureIP] measure in a meter (right now [MeterWANIP] still links to the "old" MeasureWANIP measure, instead of the "new" MeasureIP). Even if it didn't update automatically, an [!UpdateMeasure MeasureIP][!UpdateMeter TheMeterThatLinksToMeasureIP][!Redraw] would have done the job.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth