#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=Prozent.ico
#AutoIt3Wrapper_outfile=ProzentUhr.exe
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
AdlibRegister("_uhrrefresh", 250)
#include <Date.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$titel = "Prozent Uhr 0.1 - by Douky"
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate($titel, 307, 296, 228, 196)
$Group_zeit = GUICtrlCreateGroup("Group_zeit", 8, 128, 289, 161)
GUICtrlSetFont(-1, 8, 800, 0, "Comic Sans MS")
$Progress_Sekunde = GUICtrlCreateProgress(12, 266, 278, 17)
$Progress_Minute = GUICtrlCreateProgress(12, 218, 278, 17)
$Progress_Stunde = GUICtrlCreateProgress(12, 170, 278, 17)
$Label1 = GUICtrlCreateLabel("Sekunde", 14, 241, 272, 20)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Minute", 14, 194, 277, 20)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Stunde", 13, 145, 272, 24)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group_datum = GUICtrlCreateGroup("Group_datum", 8, 0, 289, 121)
GUICtrlSetFont(-1, 8, 800, 0, "Comic Sans MS")
$Progress_Monat = GUICtrlCreateProgress(14, 91, 278, 17)
$Label_Monat = GUICtrlCreateLabel("Monat", 15, 68, 272, 20)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Progress_Jahr = GUICtrlCreateProgress(13, 45, 278, 17)
$Label_Jahr = GUICtrlCreateLabel("Jahr", 14, 22, 280, 20)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;WinSetTrans($titel, "", 125)

While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit

	EndSwitch
WEnd

Func _uhrrefresh()
	If _DateIsLeapYear(@YEAR) Then
		$Jahr_in_Sekunden = 31622400
	Else
		$Jahr_in_Sekunden = 31536000
	EndIf
	GUICtrlSetData($Group_zeit, "Es ist " & @HOUR & ":" & @MIN & ":" & @SEC & " Uhr")
	GUICtrlSetData($Group_datum, "Heute ist der " & @MDAY & "." & @MON & "." & @YEAR)

	$Zahl = 100 / $Jahr_in_Sekunden * _DateDiff('s', @YEAR & "/01/01 00:00:00", _NowCalc())
	GUICtrlSetData($Progress_Jahr, $Zahl)
	GUICtrlSetData($Label_Jahr, "Jahr" & @TAB & "(" & StringFormat("%.5f", $Zahl) & '%' & ")")

	$Monatprozent = 100 / (_DateDaysInMonth(@YEAR, @MON) * 24 * 60 * 60) * _DateDiff('s', @YEAR & "/" & @MON & "/01 00:00:00", _NowCalc())
	GUICtrlSetData($Progress_Monat, $Monatprozent)
	GUICtrlSetData($Label_Monat, "Monat" & @TAB & "(" & StringFormat("%.5f", $Monatprozent) & '%' & ")")

	$Tagprozent = 100 / 86400 * (@HOUR * 60 * 60 + @MIN * 60 + @SEC)
	GUICtrlSetData($Progress_Stunde, $Tagprozent)
	GUICtrlSetData($Label3, "Tag" & @TAB & "(" & StringFormat("%.5f", $Tagprozent) & '%' & ")")

	;Stunde
	$Stundenprozent = 100 / 3600 * (@MIN * 60 + @SEC)
	GUICtrlSetData($Progress_Minute, $Stundenprozent)
	GUICtrlSetData($Label2, "Stunde" & @TAB & "(" & StringFormat("%.5f", $Stundenprozent) & '%' & ")")
	;Stunde Ende

	;Minuten
	$Minutenprozent = 100 / 60 * @SEC
	GUICtrlSetData($Progress_Sekunde, $Minutenprozent)
	GUICtrlSetData($Label1, "Minute" & @TAB & "(" & StringFormat("%.5f", $Minutenprozent) & '%' & ")")
	;Minuten Ende
EndFunc   ;==>_uhrrefresh