It is currently December 15th, 2019, 11:50 am

DIGI DayNightClock

Post your work-in-progress and completed skins to share and discuss.
xenium
Posts: 422
Joined: January 4th, 2018, 9:52 pm

DIGI DayNightClock

xenium » September 2nd, 2018, 3:18 pm

DIGI DayNightClock
Capture.PNG
Displays time, sunrise, sunset ,length of day and night for your location.

Dynamic background (day / night) based on sunrise and sunset
Time format:12H/24H

Note:
Time left until sunrise / sunset is displayed at one minute after, the moment of sunrise / sunset

Special thanks to balala for the great help offered to make this skin. :bow: :rosegift:

The visual effect of the clock is made by jsmorley. :thumbup:

Click the icon to set the location.

Download :https://www.deviantart.com/xxenium/art/DIGI-DayNightClock-761778035
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 9269
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: DIGI DayNightClock

balala » September 2nd, 2018, 5:22 pm

xenium wrote:Special thanks to balala for the great help offered to make this skin. :bow: :rosegift:
I'm glad if I could help.
xenium wrote:Click the icon to set the location.
Maybe a skin made to set the location, instead of having to type it into a file, would be nice.

But the skin is looking good, congrats :thumbup: .
xenium
Posts: 422
Joined: January 4th, 2018, 9:52 pm

Re: DIGI DayNightClock

xenium » September 3rd, 2018, 5:46 am

balala wrote:Maybe a skin made to set the location, instead of having to type it into a file, would be nice.
Yeah, it would look better, but I do not know how to do that.
An idea ?
User avatar
balala
Rainmeter Sage
Posts: 9269
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: DIGI DayNightClock

balala » September 3rd, 2018, 11:14 am

xenium wrote:Yeah, it would look better, but I do not know how to do that.
You need I think a button which could automatically detect the location (based on the own IP address, through some WebParser measures) and / or field where the user could input his country and city (through the InputText plugin). Then based on the detected / introduced data, the skin should have to write the information into the Location.inc file.
Later I'll try to come up with a sample code.
User avatar
balala
Rainmeter Sage
Posts: 9269
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: DIGI DayNightClock

balala » September 3rd, 2018, 2:20 pm

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).
xenium
Posts: 422
Joined: January 4th, 2018, 9:52 pm

Re: DIGI DayNightClock

xenium » September 3rd, 2018, 3:34 pm

balala wrote: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).
It looks very good, thank you.
For my location, it works.
But I do not know if it can be used for the Foreca site.
What are the issues:
For some countries the link contains, besides the country, city and state or province (example: US, Canada, maybe there are other countries)
Another problem would be, as it is written, the name of the country or city in the Foreca link, if it is the same as the one detected after the IP (for example, the Hong Kong name appears in the Foreca link, Hong_Kong_SAR / Hong_Kong, and the Yahoo weather link is Hong -Kong)
There are small details that would cause problems in determining the location in some cases.
I think the best solution in the present case is a possibility of introducing the entire copied link from Foreca (to avoid possible problems)
User avatar
balala
Rainmeter Sage
Posts: 9269
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: DIGI DayNightClock

balala » September 3rd, 2018, 3:37 pm

xenium wrote:I think the best solution in the present case is a possibility of introducing the entire copied link from Foreca (to avoid possible problems)
OK, as you wish.
xenium
Posts: 422
Joined: January 4th, 2018, 9:52 pm

Re: DIGI DayNightClock

xenium » September 3rd, 2018, 3:43 pm

.... something similar like at weather.com where instead of a link, a code is entered
User avatar
balala
Rainmeter Sage
Posts: 9269
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: DIGI DayNightClock

balala » September 3rd, 2018, 5:08 pm

xenium wrote:.... something similar like at weather.com where instead of a link, a code is entered
Probably you'll have to use an InputText plugin measure.
xenium
Posts: 422
Joined: January 4th, 2018, 9:52 pm

Re: DIGI DayNightClock

xenium » September 5th, 2018, 11:16 am

balala wrote:Probably you'll have to use an InputText plugin measure.
I made this code using the InputText plugin.
The code works, but I want the skin to be refreshed automatically when the Enter key is pressed.
I would also like to know if I somehow skipped something in the code.

Thank you

Code: Select all

[Rainmeter]
Update=-1


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



[MeterBg]
Meter=Shape
X=0
Y=0
Shape=Rectangle 1,1,800,40 | Fill Color 13,13,13 | Stroke Color 0,0,0,0

[MeterBg2]
Meter=Shape
X=0
Y=40
Shape=Rectangle 1,1,800,300 | Fill Color 32,64,132 | Stroke Color 0,0,0,0

[MeterLocation]
Meter=Shape
X=25
Y=190
Shape=Rectangle 1,1,750,30 | Fill Color 0,0,0,0 | Stroke Color 255,255,255,255

[MeterClose]
Meter=Shape
X=325
Y=277
Shape=Rectangle 1,1,150,30 | Fill Color 0,0,0,0 | Stroke Color 255,255,255,255


[MeterTitle]
Meter=String
StringAlign=Centercenter
FontFace=century gothic
FontColor=255,255,255
FontSize=15
X=400
Y=22
Text=SETTINGS: LOCATION
AntiAlias=1

[MeterInstructions]
Meter=String
StringAlign=Left
FontFace=century gothic
FontColor=255,255,255
FontSize=12
X=40
Y=80
Text=1.Go to website Foreca.com   >>>#CRLF#2.Write the name of the city and select it from the list that appears.#CRLF#3.When you are on the page with your city, copy the entire address.#CRLF#4.Insert the copied address in the field below and press the "Enter" key to apply changes.
AntiAlias=1

[MeterWebsite]
Meter=Image
ImageName=#@#Location.png
X=285r
Y=68
W=30
AntiAlias=1
LeftMouseDownAction=["https://www.foreca.com/"]

[MeterAddress]
Meter=String
StringAlign=Left
FontFace=century gothic
FontColor=255,255,0
FontSize=12
X=30
Y=196
Text=#Location#
AntiAlias=1
ToolTipText=Click and paste address
LeftMouseUpAction=[!PluginBang "MeterInput ExecuteBatch 1"]

[MeterInput]
Measure=Plugin
Plugin=InputText.dll
StringAlign=Left
FontFace=century gothic
FontSize=12
X=30
Y=196
W=740
H=20
AntiAlias=1
FocusDismiss=1
Command1=[!WriteKeyValue Variables LocationURL "$UserInput$""#@#Location.inc"][!Refresh]
DefaultValue="#LocationURL#"

[MeterCloseButton]
Meter=String
StringAlign=Centercenter
FontFace=century gothic
FontSize=12
FontColor=255,255,255
X=400
Y=293
Text=Close Settings
SolidColor=0,0,0,1
AntiAlias=1
MouseOverAction=!Execute [!ShowMeter MeterCloseButtonActive][!HideMeter MeterCloseButton][!Update]

[MeterCloseButtonActive]
Meter=String
StringAlign=Centercenter
FontFace=century gothic
FontSize=12
StringStyle=Bold
FontColor=255,255,255
X=r
Y=r
Text=Close Settings
SolidColor=0,0,0,1
AntiAlias=1
Hidden=1
LeftMouseUpAction=!DeactivateConfig "DIGI DayNightClock\Settings" "Settings.ini"
MouseLeaveAction=!Execute [!ShowMeter MeterCloseButton][!HideMeter MeterCloseButtonActive][!Update]