Thank you all for your kindness. I've been on many coding forums in the past most ranging from condescending to dismissive. There is a very welcoming supportive community vibe here of which I am appreciative.
I gained a lot of understanding in the examples provided. The 'Disabled' command alone made me very happy as that was a problem fixed for part I haven't written yet.
That said, I'd like to be lazy now. I'm tired of staring at this problem and would like to just post the whole code and have you show me what I am doing wrong. I'm not asking to have the whole thing transformed. There is much wrong, much not finished and much more that can be streamlined and improved. But I look forward to doing all that myself.
I just want this one little part to work. I think at this point I can learn more from the correction than by fighting (randomly making changes) for it.
When I run it, it shows the Ext IP and after 5 seconds the Location. So the location display code (very bottom of the skin) still works. If the IP changes, less than 90 seconds later the IP display updates. But the location display does not.
I can see your part work but the part I had to add clearly does not.
I took the timer off the location so that it would only be called when needed. That is probably where I messed up but I can't see it.
Again, please resist the urge to tidy and improve. I'd appreciate as little as humanly possible be changed to make the location measure update when the ip changes. I look forward to fixing the rest as I learn.
Code: Select all
Information=My second widget
License=Free to all to do with as they like
; Notes: This widget makes use of three websites:
; http://www.Bing.com is called every 3 seconds to test Ping.
; http://icanhazip.com is called every 90 seconds to determine External IP
; http://ipinfo.io/ is called every 20 minutes to determine location
; (eventually this will be tried to change in External IP)
; Static Variables
;tied to PingBar.png
W=(#BarWidth# + (#BackPadding#*2))
; PIA Status
; Just displays a logo at the moment.
;Future spot for PIA and LeapIP status indication
X=(((#BarWidth#/2) + #BackPadding#/2)-8)
; Ext IP
FinishAction=[!EnableMeasure MeasureCheck][!UpdateMeasure MeasureCheck]
IfNotMatchAction=[!SetVariable IPLast "[MeasureCheck]"][!WriteKeyValue Variables IPLast "[MeasureCheck]"][!UpdateMeasure "MeasureWebParseLocation"]
Text="Ext IP: %1"
InlineSetting=Color | #OfflineColor#
FinishAction=[!UpdateMeter "MeterPingBar"][!UpdateMeter "MeterPing"]
TimeoutAction=[!UpdateMeter "MeterPingBar"][!UpdateMeter "MeterPing"]
; Internet Offline ^
Substitute "-1" : "Offline", "1" : "Ping: %1ms"
; if H is changed dimensions of PingBar.png must changed as well.
Text = "Ping: %1ms"
; Current Upload Traffic
; Current Download Traffic
; Network Traffic Histograph
RegExp=(?siU)<a class="flag .*</a>\n(.*)</td>
However if you want to show me how to merge [MeasureWebParseLocation] and [MeasureLocation] into the one measure I think they want to be I would be happy as I am completely lost how the second one strips off leading spaces and tabs. If not the other is all that is really important at this juncture.
Oh, one thing confuses me on the previous example. If IfMatch works in a RegExp manner, why do the periods in the IP address not mess things up? What makes it literal?
Please let me know if I become annoying.