And here is a first sample code, as I've promised.
It's a very simple code and it does one single thing: when loaded you have to click the Detect button to ask the skin to automatically detect your current location. It does this through the
https://www.iplocationtools.com/ URL. If it succeeds, the name of the country and city appears on the skin and you can click OK to save these information.
You have to save this code as a Settings.ini file into the main folder, next to 12H.ini and 24H.ini. If you like it, you have to add a button (or whatever) to the skins, to can easily open the above settings tool.
The code:
Code: Select all
[Rainmeter]
BackgroundMode=2
SolidColor=0,0,0,180
[MeasureDetect]
Measure=WebParser
Url=https://www.iplocationtools.com/
RegExp=(?siU)<span class=".*" data-placement="top" title=".*"></span>(.*)</td>.*<div><label><strong>Weather Station</strong></label></div>.*(.*) \(.*\)<div>
FinishAction=[!SetVariable URL "https://www.foreca.com/[MeasureCountry]/[MeasureCity]"][!UpdateMeter "MeterOK"]
Disabled=1
[MeasureCountry]
Measure=WebParser
Url=[MeasureDetect]
StringIndex=1
RegExpSubstitute=1
Substitute="\s":""
[MeasureCity]
Measure=WebParser
Url=[MeasureDetect]
StringIndex=2
RegExpSubstitute=1
Substitute="\s":""
[MeterCountryCity]
Meter=STRING
MeasureName=MeasureCountry
MeasureName2=MeasureCity
X=0
Y=0
W=200
H=32
SolidColor=0,0,0,1
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Country: %1#CRLF#City: %2
[MeterDetect]
Meter=String
X=35r
Y=15R
W=40
H=20
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=150,150,150,200
FontSize=10
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=CENTERCENTER
AntiAlias=1
Text=Detect
DynamicVariables=1
MouseOverAction=[!SetOption #CURRENTSECTION# SolidColor "153,217,234,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# SolidColor "150,150,150,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=[!EnableMeasure "MeasureDetect"][!CommandMeasure "MeasureDetect" "Update"]
[MeterOK]
Meter=String
X=80r
Y=0r
W=40
H=20
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=150,150,150,200
FontSize=10
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=CENTERCENTER
AntiAlias=1
Text=OK
DynamicVariables=1
MouseOverAction=[!SetOption #CURRENTSECTION# SolidColor "153,217,234,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# SolidColor "150,150,150,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=[!WriteKeyValue Variables LocationURL "#URL#" "#@#Location.inc"][!ActivateConfig "#CURRENTCONFIG#" "24H.ini"]
[MeterCancel]
Meter=String
X=80r
Y=0r
W=40
H=20
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=150,150,150,200
FontSize=10
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=CENTERCENTER
AntiAlias=1
Text=Cancel
MouseOverAction=[!SetOption #CURRENTSECTION# SolidColor "153,217,234,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# SolidColor "150,150,150,200"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=[!ActivateConfig "#CURRENTCONFIG#" "24H.ini"]
Does it work?
If it does, it can be further improved, adding InputText plugin measures, to can manually edit the country and the city (if needed).