BugFix Posted October 5, 2005 Share Posted October 5, 2005 (edited) Hi @all,I've found AutoIt during surfing in www. I've tested it and I'm with enthusiasm for sth.The following is my first AutoIt-script. I hope someone like it and has use for it.The date output is in german notation (dd.mm.yyyy and dd.mm.). Thats why I've created some functions to convert.;===============================================================================;; Description: Datum ( YYYY/MM/TT ) umstellen auf ==> ( TT.MM.JJJJ );; Parameter: $Datum(YYYY/MM/TT);; Return Value: (TT.MM.JJJJ);;===============================================================================Func _DateToNorm($Datum) Return StringMid($Datum,9) & "." & StringMid($Datum,6,2) & "." & StringMid($Datum,1,4)EndFunc;===============================================================================;; Description: Ausgabe aktuelles Datum als ( TT.MM.JJJJ );; Parameter: keine;; Return Value: (TT.MM.JJJJ);;===============================================================================Func _NowNormDate() Return ( @MDAY & "." & @MON & "." & @YEAR )EndFuncThe following function is for dedection for any weekday in Gregorian calendar (1583 - 8201);===============================================================================;; Description: Ermittlung Wochentag aus Datum;; Parameter: $D, $mon, $year;; Return Value Wochentag;;===============================================================================Func _WeekDay($D,$mon,$year) $Schalt = 0 If _DateIsLeapYear($year) Then ;Überprüfung Schaltjahr $Schalt = 1 EndIf If $mon = 2 and $D > 28 Then ;Überprüfung/Korrektur Februardatum If $Schalt = 0 Then $D = 28 Else $D = 29 EndIf EndIf If ($mon = 4 Or $mon = 6 Or $mon = 9 Or $mon = 11 ) And $D > 30 Then $D = 30 EndIf $C = Int($year/100) ;Bestimmung Jahrhundert $J = Mod($year, 100) ;Bestimmung Jahr If $mon < 3 Then ;Jan und Feb gehören zum Vorjahr(hundert) If $J = 0 Then $J = 99 $C =$C -1 Else $J = $J - 1 EndIf EndIf Select Case $mon > 2 ;Altrömische Zeitrechnung beginnt im März $M = $mon-2 Case Else $M = $mon+10 EndSelect $W = Mod((_Floor(2.6*$M-0.2)+$D+$J+(_Floor($J/4))+(_Floor($C/4))-2*$C), 7) ; Ist das Ergebnis negativ , so addiert man 7 hinzu, so dass eine positive Zahl entsteht. ; Diese Zahl entspricht dann dem Wochentag. If $W < 0 Then $W = $W + 7 EndIf Select Case $W = 0 $WeekDay = "Sonntag" Case $W = 1 $WeekDay = "Montag" Case $W = 2 $WeekDay = "Dienstag" Case $W = 3 $WeekDay = "Mittwoch" Case $W = 4 $WeekDay = "Donnerstag" Case $W = 5 $WeekDay = "Freitag" Case $W = 6 $WeekDay = "Sonnabend" EndSelect Return $WeekDayEndFuncI've also added a mathematic function (DIV). _DIV($a,$ give the same output like Int($a / $ but it was better to have the same notation like Mod($a, $ that also be used to avoid failures. Thats why:;===============================================================================;; Function Name: _Div();; Description: Ermittelt den ganzzahligen Anteil einer Division.;; Syntax: _Div( $Div, $Dis );; Parameter(s): $Div = Divident; $Dis = Divisor;;===============================================================================Func _Div($Div, $Dis) Return Int($Div / $Dis)EndFuncAnd now the complete script:; ----------------------------------------------------------------------------;; AutoIt Version: 3.1.0;;Osterformel (Gauss); a = Jahr mod 19; b = Jahr mod 4; c = Jahr mod 7; H1 = Jahr div 100; H2 = Jahr div 400; N = 4 + H1 - H2; M = 15 + H1 - H2 - [(8 * H1 + 13) div 25]; d = (19 * a + M) mod 30; e = (2 * b + 4 * c + 6 * d + N) mod 7;wenn d + e = 35, dann ostern = 50;wenn d = 28 und e = 6 und a > 10, dann ostern = 49;in allen anderen Fällen: ostern = 22 + d + e;ostern: Ostersonntag als Märzdatum;; ----------------------------------------------------------------------------#include <GuiConstants.au3>#include <Date.au3>#include <math.au3>GuiCreate("Wochen- und Feiertagsbestimmung", 680, 485,(@DesktopWidth-680)/2, (@DesktopHeight-485)/2 )GUISetBkColor (0xFFFACD)$Label_1 = GuiCtrlCreateLabel("Bestimmen Sie den Wochentag ! (gültig: 1583 - 8201)", 200, 10, 280, 20)GUICtrlSetColor($Label_1,0xFF0000)$aktDatum = GuiCtrlCreateLabel(_NowNormDate(),620,10,60,20);Gruppe Optionsfelder zur Datumsauswahl$Group_T = GuiCtrlCreateGroup("Tag", 15, 25, 650, 60)$R1 = GuiCtrlCreateRadio("01", 20, 45, 30, 15)GUICtrlSetState($R1,$gui_checked)$R2 = GuiCtrlCreateRadio("02", 60, 45, 30, 15)$R3 = GuiCtrlCreateRadio("03", 100, 45, 30, 15)$R4 = GuiCtrlCreateRadio("04", 140, 45, 30, 15)$R5 = GuiCtrlCreateRadio("05", 180, 45, 30, 15)$R6 = GuiCtrlCreateRadio("06", 220, 45, 30, 15)$R7 = GuiCtrlCreateRadio("07", 260, 45, 30, 15)$R8 = GuiCtrlCreateRadio("08", 300, 45, 30, 15)$R9 = GuiCtrlCreateRadio("09", 340, 45, 30, 15)$R10 = GuiCtrlCreateRadio("10", 380, 45, 30, 15)$R11 = GuiCtrlCreateRadio("11", 420, 45, 30, 15)$R12 = GuiCtrlCreateRadio("12", 460, 45, 30, 15)$R13 = GuiCtrlCreateRadio("13", 500, 45, 30, 15)$R14 = GuiCtrlCreateRadio("14", 540, 45, 30, 15)$R15 = GuiCtrlCreateRadio("15", 580, 45, 30, 15)$R16 = GuiCtrlCreateRadio("16", 20, 60, 30, 15)$R17 = GuiCtrlCreateRadio("17", 60, 60, 30, 15)$R18 = GuiCtrlCreateRadio("18", 100, 60, 30, 15)$R19 = GuiCtrlCreateRadio("19", 140, 60, 30, 15)$R20 = GuiCtrlCreateRadio("20", 180, 60, 30, 15)$R21 = GuiCtrlCreateRadio("21", 220, 60, 30, 15)$R22 = GuiCtrlCreateRadio("22", 260, 60, 30, 15)$R23 = GuiCtrlCreateRadio("23", 300, 60, 30, 15)$R24 = GuiCtrlCreateRadio("24", 340, 60, 30, 15)$R25 = GuiCtrlCreateRadio("25", 380, 60, 30, 15)$R26 = GuiCtrlCreateRadio("26", 420, 60, 30, 15)$R27 = GuiCtrlCreateRadio("27", 460, 60, 30, 15)$R28 = GuiCtrlCreateRadio("28", 500, 60, 30, 15)$R29 = GuiCtrlCreateRadio("29", 540, 60, 30, 15)$R30 = GuiCtrlCreateRadio("30", 580, 60, 30, 15)$R31 = GuiCtrlCreateRadio("31", 620, 60, 30, 15)$Group_M = GuiCtrlCreateGroup("Monat", 15, 100, 255, 60)$R1m = GuiCtrlCreateRadio("01", 20, 120, 30, 15)GUICtrlSetState($R1m,$gui_checked)$R2m = GuiCtrlCreateRadio("02", 60, 120, 30, 15)$R3m = GuiCtrlCreateRadio("03", 100, 120, 30, 15)$R4m = GuiCtrlCreateRadio("04", 140, 120, 30, 15)$R5m = GuiCtrlCreateRadio("05", 180, 120, 30, 15)$R6m = GuiCtrlCreateRadio("06", 220, 120, 30, 15)$R7m = GuiCtrlCreateRadio("07", 20, 135, 30, 15)$R8m = GuiCtrlCreateRadio("08", 60, 135, 30, 15)$R9m = GuiCtrlCreateRadio("09", 100, 135, 30, 15)$R10m = GuiCtrlCreateRadio("10", 140, 135, 30, 15)$R11m = GuiCtrlCreateRadio("11", 180, 135, 30, 15)$R12m = GuiCtrlCreateRadio("12", 220, 135, 30, 15)$L_MsgTag = GUICtrlCreateLabel("",340,100,200,20)GUICtrlSetColor($L_MsgTag,0xFF0000)$Label_4 = GuiCtrlCreateLabel("Jahr", 340, 122, 40, 20)$But_minus = GUICtrlCreateButton("-",406,123,15,15)$But_plus = GUICtrlCreateButton("+",468,123,15,15)$Input_7 = GUICtrlCreateInput(StringMid(_NowCalcDate(),1,4), 425, 120, 40, 20)$Button_8 = GuiCtrlCreateButton("Start", 615, 105, 50, 20)$Ende = GUICtrlCreateButton("Ende",615,145,50,20)$L_Schaltjahr = GUICtrlCreateLabel("",500,122,80,20)$Label_9 = GuiCtrlCreateLabel("Wochentag:", 340, 145, 90, 20)$Label_10 = GuiCtrlCreateLabel("", 417, 145, 90, 20)$L_Feiertage = GUICtrlCreateLabel("Die Feiertage dieses Jahres", 265, 175, 150, 20)$L_Fix = GUICtrlCreateLabel("Unveränderlich:", 70, 200, 90, 20)$L_Variabel = GUICtrlCreateLabel("Veränderlich (gültig: 1583 - 2999):", 380, 200, 170,20)GUICtrlSetColor($L_Feiertage,0xFF0000)GUICtrlSetColor($L_Fix,0xFF0000)GUICtrlSetColor($L_Variabel,0xFF0000)GUICtrlSetColor($L_Schaltjahr,0x0000ff)GUICtrlSetColor($Label_10,0xFF0000); Fixe Feiertage:$L_Neuj = GUICtrlCreateLabel("Neujahr", 80, 220, 90, 20) $L_NeujDat = GUICtrlCreateLabel("01.01.", 230, 220, 70, 20)$WD_N = GUICtrlCreateLabel("",275,220,60,20)$L_3K = GUICtrlCreateLabel("Heilige Drei Könige", 80, 235, 110, 20)$L_3KDat = GUICtrlCreateLabel("06.01.", 230, 235, 70, 20)$WD_3K = GUICtrlCreateLabel("",275,235,60,20)$L_Val = GUICtrlCreateLabel("Valentinstag", 80, 250, 110, 20)$L_ValDat = GUICtrlCreateLabel("14.02.", 230, 250,70,20)$WD_Val = GUICtrlCreateLabel("",275,250,60,20)$L_Mai = GUICtrlCreateLabel("Maifeiertag",80,265,110,20)$L_MaiDat = GUICtrlCreateLabel("01.05.",230,265,70,20)$WD_Mai = GUICtrlCreateLabel("",275,265,60,20)$L_Einheit =GUICtrlCreateLabel("Tag der Deutschen Einheit",80,280,145,20)$L_EinheitDat =GUICtrlCreateLabel("03.10.",230,280,70,20)$WD_Einheit = GUICtrlCreateLabel("",275,280,60,20)$L_Ref = GUICtrlCreateLabel("Reformationstag",80,295,145,20)$L_RefDat = GUICtrlCreateLabel("31.10.",230,295,70,20)$WD_Ref = GUICtrlCreateLabel("",275,295,60,20)$L_Aller = GUICtrlCreateLabel("Allerheiligen",80,310,145,20)$L_AllerDat = GUICtrlCreateLabel("01.11.",230,310,70,20)$WD_Aller = GUICtrlCreateLabel("",275,310,60,20)$L_HlA = GUICtrlCreateLabel("Heiligabend",80,325,145,20)$L_HlADat = GUICtrlCreateLabel("24.12.",230,325,70,20)$WD_Heil = GUICtrlCreateLabel("",275,325,60,20)$L_1WT = GUICtrlCreateLabel("1. Weihnachtsfeiertag",80,340,145,20)$L_1WTDat = GUICtrlCreateLabel("25.12.",230,340,70,20)$WD_1W = GUICtrlCreateLabel("",275,340,60,20)$L_2WT = GUICtrlCreateLabel("2. Weihnachtsfeiertag",80,355,145,20)$L_2WTDat = GUICtrlCreateLabel("26.12.",230,355,70,20)$WD_2W = GUICtrlCreateLabel("",275,355,60,20)$L_Sil = GUICtrlCreateLabel("Silvester",80,370,145,20)$L_SilDat = GUICtrlCreateLabel("31.12.",230,370,70,20)$WD_Sil = GUICtrlCreateLabel("",275,370,60,20)$L_Advent = GUICtrlCreateLabel("Adventstage:",185,420,80,20)GUICtrlSetColor($L_Advent,0xFF0000)$L_1Adv = GUICtrlCreateLabel("1. Advent",80,440,60,20)$L_1AdvDat = GUICtrlCreateLabel("",90,460,40,20)$L_2Adv = GUICtrlCreateLabel("2. Advent",150,440,60,20)$L_2AdvDat = GUICtrlCreateLabel("",160,460,40,20)$L_3Adv = GUICtrlCreateLabel("3. Advent",220,440,60,20)$L_3AdvDat = GUICtrlCreateLabel("",230,460,40,20)$L_4Adv = GUICtrlCreateLabel("4. Advent",290,440,60,20)$L_4AdvDat = GUICtrlCreateLabel("",300,460,40,20)GUICtrlSetColor($L_1AdvDat,0x0000ff)GUICtrlSetColor($L_2AdvDat,0x0000ff)GUICtrlSetColor($L_3AdvDat,0x0000ff)GUICtrlSetColor($L_4AdvDat,0x0000ff); Variable Feiertage:$L_WFast = GUICtrlCreateLabel("Weiberfastnacht",390,220,145,20) $L_WFastDate = GUICtrlCreateLabel("",550,220,70,20)$L_Ros = GUICtrlCreateLabel("Rosenmontag",390,235,145,20)$L_RosDat = GUICtrlCreateLabel("",550,235,70,20)$L_Fast = GUICtrlCreateLabel("Fastnacht",390,250,145,20)$L_FastDat = GUICtrlCreateLabel("",550,250,70,20)$L_Asch = GUICtrlCreateLabel("Aschermittwoch",390,265,145,20)$L_AschDat = GUICtrlCreateLabel("",550,265,70,20)$L_GrDo = GUICtrlCreateLabel("Gründonnerstag",390,280,145,20)$L_GrDoDat = GUICtrlCreateLabel("",550,280,70,20)$L_Kar = GUICtrlCreateLabel("Karfreitag",390,295,145,20)$L_KarDat = GUICtrlCreateLabel("",550,295,70,20)$L_OSa = GUICtrlCreateLabel("Ostersamstag",390,310,145,20)$L_OSaDat = GUICtrlCreateLabel("",550,310,70,20)$L_OSo = GUICtrlCreateLabel("Ostersonntag",390,325,145,20)$L_OSoDat = GUICtrlCreateLabel("",550,325,70,20)$L_OMo = GUICtrlCreateLabel("Ostermontag",390,340,145,20)$L_OMoDat = GUICtrlCreateLabel("",550,340,70,20)$L_HiFa = GUICtrlCreateLabel("Christi Himmelfahrt",390,355,145,20)$L_HiFaDat = GUICtrlCreateLabel("",550,355,70,20)$L_Mutter = GUICtrlCreateLabel("Muttertag",390,370,145,20)$L_MutterDat = GUICtrlCreateLabel("",550,370,70,20) $L_PfSo = GUICtrlCreateLabel("Pfingstsonntag",390,385,145,20)$L_PfSoDat = GUICtrlCreateLabel("",550,385,70,20)$L_PfMo = GUICtrlCreateLabel("Pfingstmontag",390,400,145,20)$L_PfMoDat = GUICtrlCreateLabel("",550,400,70,20)$L_Fro = GUICtrlCreateLabel("Fronleichnam",390,415,145,20)$L_FroDat = GUICtrlCreateLabel("",550,415,70,20)$L_Ernte = GUICtrlCreateLabel("Erntedankfest",390,430,145,20)$L_ErnteDat = GUICtrlCreateLabel("",550,430,70,20)$L_BuB = GUICtrlCreateLabel("Buß- und Bettag",390,445,145,20)$L_BuBDat = GUICtrlCreateLabel("",550,445,70,20)$L_TotSo = GUICtrlCreateLabel("Totensonntag",390,460,145,20)$L_TotSoDat = GUICtrlCreateLabel("",550,460,70,20)GuiSetState()While 1 $msg = GuiGetMsg() If $msg = $But_minus Then GUICtrlSetData($Input_7,GUICtrlRead($Input_7)-1) EndIf If $msg = $But_plus Then GUICtrlSetData($Input_7,GUICtrlRead($Input_7)+1) EndIf If $msg = $Button_8 Then GUICtrlSetData($L_MsgTag,"") GUICtrlSetData($L_Schaltjahr,"") GUICtrlSetData($L_WFastDate,"") GUICtrlSetData($L_RosDat,"") GUICtrlSetData($L_FastDat,"") GUICtrlSetData($L_AschDat,"") GUICtrlSetData($L_GrDoDat,"") GUICtrlSetData($L_KarDat,"") GUICtrlSetData($L_OSaDat,"") GUICtrlSetData($L_OSoDat,"") GUICtrlSetData($L_OMoDat,"") GUICtrlSetData($L_HiFaDat,"") GUICtrlSetData($L_PfSoDat,"") GUICtrlSetData($L_MutterDat,"") GUICtrlSetData($L_PfMoDat,"") GUICtrlSetData($L_FroDat,"") GUICtrlSetData($L_ErnteDat,"") GUICtrlSetData($L_TotSoDat,"") GUICtrlSetData($L_BuBDat,"") GUICtrlSetData($Label_10, "") GUICtrlSetData($WD_N,"") GUICtrlSetData($WD_3K,"") GUICtrlSetData($WD_Val,"") GUICtrlSetData($WD_Mai,"") GUICtrlSetData($WD_Einheit,"") GUICtrlSetData($WD_Ref,"") GUICtrlSetData($WD_Aller,"") GUICtrlSetData($WD_Heil,"") GUICtrlSetData($WD_1W,"") GUICtrlSetData($WD_2W,"") GUICtrlSetData($WD_Sil,"") GUICtrlSetData($L_1AdvDat,"") GUICtrlSetData($L_2AdvDat,"") GUICtrlSetData($L_3AdvDat,"") GUICtrlSetData($L_4AdvDat,"") $day1 = GUICtrlRead($R1) $day2 = GUICtrlRead($R2) $day3 = GUICtrlRead($R3) $day4 = GUICtrlRead($R4) $day5 = GUICtrlRead($R5) $day6 = GUICtrlRead($R6) $day7 = GUICtrlRead($R7) $day8 = GUICtrlRead($R8) $day9 = GUICtrlRead($R9) $day10 = GUICtrlRead($R10) $day11 = GUICtrlRead($R11) $day12 = GUICtrlRead($R12) $day13 = GUICtrlRead($R13) $day14 = GUICtrlRead($R14) $day15 = GUICtrlRead($R15) $day16 = GUICtrlRead($R16) $day17 = GUICtrlRead($R17) $day18 = GUICtrlRead($R18) $day19 = GUICtrlRead($R19) $day20 = GUICtrlRead($R20) $day21 = GUICtrlRead($R21) $day22 = GUICtrlRead($R22) $day23 = GUICtrlRead($R23) $day24 = GUICtrlRead($R24) $day25 = GUICtrlRead($R25) $day26 = GUICtrlRead($R26) $day27 = GUICtrlRead($R27) $day28 = GUICtrlRead($R28) $day29 = GUICtrlRead($R29) $day30 = GUICtrlRead($R30) $day31 = GUICtrlRead($R31) $mon1 = GUICtrlRead($R1m) $mon2 = GUICtrlRead($R2m) $mon3 = GUICtrlRead($R3m) $mon4 = GUICtrlRead($R4m) $mon5 = GUICtrlRead($R5m) $mon6 = GUICtrlRead($R6m) $mon7 = GUICtrlRead($R7m) $mon8 = GUICtrlRead($R8m) $mon9 = GUICtrlRead($R9m) $mon10 = GUICtrlRead($R10m) $mon11 = GUICtrlRead($R11m) $mon12 = GUICtrlRead($R12m) Select Case $day1 = 1 $D = 1 Case $day2 = 1 $D = 2 Case $day3 = 1 $D = 3 Case $day4 = 1 $D = 4 Case $day5 = 1 $D = 5 Case $day6 = 1 $D = 6 Case $day7 = 1 $D = 7 Case $day8 = 1 $D = 8 Case $day9 = 1 $D = 9 Case $day10 = 1 $D = 10 Case $day11 = 1 $D = 11 Case $day12 = 1 $D = 12 Case $day13 = 1 $D = 13 Case $day14 = 1 $D = 14 Case $day15 = 1 $D = 15 Case $day16 = 1 $D = 16 Case $day17 = 1 $D = 17 Case $day18 = 1 $D = 18 Case $day19 = 1 $D = 19 Case $day20 = 1 $D = 20 Case $day21 = 1 $D = 21 Case $day22 = 1 $D = 22 Case $day23 = 1 $D = 23 Case $day24 = 1 $D = 24 Case $day25 = 1 $D = 25 Case $day26 = 1 $D = 26 Case $day27 = 1 $D = 27 Case $day28 = 1 $D = 28 Case $day29 = 1 $D = 29 Case $day30 = 1 $D = 30 Case $day31 = 1 $D = 31 EndSelect Select Case $mon1 = 1 $mon = 1 Case $mon2 = 1 $mon = 2 Case $mon3 = 1 $mon = 3 Case $mon4 = 1 $mon = 4 Case $mon5 = 1 $mon = 5 Case $mon6 = 1 $mon = 6 Case $mon7 = 1 $mon = 7 Case $mon8 = 1 $mon = 8 Case $mon9 = 1 $mon = 9 Case $mon10 = 1 $mon = 10 Case $mon11 = 1 $mon = 11 Case $mon12 = 1 $mon = 12 EndSelect $year = GUICtrlRead($Input_7) ;Eingegebenes Jahr(JJJJ) $Schalt = 0 If _DateIsLeapYear($year) Then ;Überprüfung Schaltjahr $Schalt = 1 GUICtrlSetData($L_Schaltjahr,"Schaltjahr") EndIf If $mon = 2 and $D > 28 Then ;Überprüfung/Korrektur Februardatum If $Schalt = 0 Then $D = 28 GUICtrlSetState($R28,$gui_checked) Else $D = 29 GUICtrlSetState($R29,$gui_checked) EndIf GUICtrlSetData($L_MsgTag,"'Tag' für Berechnung auf "& $D & " korrigiert!") EndIf If ($mon = 4 Or $mon = 6 Or $mon = 9 Or $mon = 11 ) And $D > 30 Then $D = 30 GUICtrlSetData($L_MsgTag,"'Tag' für Berechnung auf "& $D & " korrigiert!") GUICtrlSetState($R30,$gui_checked) EndIf $C = Int($year/100) ;Bestimmung Jahrhundert $J = Mod($year, 100) ;Bestimmung Jahr If $mon < 3 Then ;Jan und Feb gehören zum Vorjahr(hundert) If $J = 0 Then $J = 99 $C =$C -1 Else $J = $J - 1 EndIf EndIf Select Case $mon > 2 ;Altrömische Zeitrechnung beginnt im März $M = $mon-2 Case Else $M = $mon+10 EndSelect $W = Mod((_Floor(2.6*$M-0.2)+$D+$J+(_Floor($J/4))+(_Floor($C/4))-2*$C), 7) ; Ist das Ergebnis negativ , so addiert man 7 hinzu, so dass eine positive Zahl entsteht. ; Diese Zahl entspricht dann dem Wochentag. If $W < 0 Then $W = $W + 7 EndIf If $year > 1582 And $year < 8202 Then Select Case $W = 0 GUICtrlSetData($Label_10, "Sonntag") Case $W = 1 GUICtrlSetData($Label_10, "Montag") Case $W = 2 GUICtrlSetData($Label_10, "Dienstag") Case $W = 3 GUICtrlSetData($Label_10, "Mittwoch") Case $W = 4 GUICtrlSetData($Label_10, "Donnerstag") Case $W = 5 GUICtrlSetData($Label_10, "Freitag") Case $W = 6 GUICtrlSetData($Label_10, "Sonnabend") EndSelect EndIf GUICtrlSetData($WD_N,_WeekDay(1,1,$year)) GUICtrlSetData($WD_3K,_WeekDay(6,1,$year)) GUICtrlSetData($WD_Val,_WeekDay(14,2,$year)) GUICtrlSetData($WD_Mai,_WeekDay(1,5,$year)) GUICtrlSetData($WD_Einheit,_WeekDay(3,10,$year)) GUICtrlSetData($WD_Ref,_WeekDay(31,10,$year)) GUICtrlSetData($WD_Aller,_WeekDay(1,11,$year)) GUICtrlSetData($WD_Heil,_WeekDay(24,12,$year)) GUICtrlSetData($WD_1W,_WeekDay(25,12,$year)) GUICtrlSetData($WD_2W,_WeekDay(26,12,$year)) GUICtrlSetData($WD_Sil,_WeekDay(31,12,$year)) GUICtrlSetColor($WD_N,0x0000ff) GUICtrlSetColor($WD_3K,0x0000ff) GUICtrlSetColor($WD_Val,0x0000ff) GUICtrlSetColor($WD_Mai,0x0000ff) GUICtrlSetColor($WD_Einheit,0x0000ff) GUICtrlSetColor($WD_Ref,0x0000ff) GUICtrlSetColor($WD_Aller,0x0000ff) GUICtrlSetColor($WD_Heil,0x0000ff) GUICtrlSetColor($WD_1W,0x0000ff) GUICtrlSetColor($WD_2W,0x0000ff) GUICtrlSetColor($WD_Sil,0x0000ff) ;Ermittlung Ostern und abhängige Feiertage (Osterformel Gauss) If $year > 1582 And $year < 3000 Then $aa = Mod($year,19) $bb = Mod($year,4) $cc = Mod($year,7) $H1 = _Div($year,100) $H2 = _Div($year,400) $N = 4 + $H1 - $H2 $MM = 15 + $H1 - $H2 - _Floor(_Div((8 * $H1 + 13),25)) $dd = Mod((19 * $aa + $MM),30) $ee = Mod((2 * $bb + 4 * $cc + 6 * $dd + $N),7) If $dd + $ee = 35 Then $Easter = 50 Else If $dd = 28 And $ee =6 And $aa > 10 Then $Easter = 49 Else $Easter = 22 + $dd + $ee EndIf EndIf If $Easter < 32 Then $EasterDay = $Easter $EasterMonth = "03" Else $EasterDay = $Easter - 31 $EasterMonth = "04" EndIf If $EasterDay < 10 Then $EasterDay = "0" & $Easterday EndIf If $year < 1900 Then ;Datumsoperationen nur mgl. wenn > 1900 , Jahr wird konvertiert $RestJahr = Mod($year,100) If $Schalt = 1 Then if $RestJahr < 10 Then $RestJahr = "0" & $RestJahr EndIf $Tempyear = 20 & $RestJahr Else if $RestJahr < 10 Then $RestJahr = "0" & $RestJahr EndIf $Tempyear = 19 & $RestJahr EndIf $EasterDate = $Tempyear&"/"&$EasterMonth&"/"&$EasterDay Else $EasterDate = $year&"/"&$EasterMonth&"/"&$EasterDay EndIf $WFastDate = _DateAdd( 'd',-52,$EasterDate) $RosDat = _DateAdd( 'd',-48,$EasterDate) $FastDat = _DateAdd( 'd',-47,$EasterDate) $AschDat = _DateAdd( 'd',-46,$EasterDate) $GrDoDat = _DateAdd( 'd',-3,$EasterDate) $KarDat = _DateAdd( 'd',-2,$EasterDate) $OSaDat = _DateAdd( 'd',-1,$EasterDate) $OSoDat = $EasterDate $OMoDat = _DateAdd( 'd',1,$EasterDate) $HiFaDat = _DateAdd( 'd',39,$EasterDate) $PfSoDat = _DateAdd( 'd',49,$EasterDate) $PfMoDat = _DateAdd( 'd',50,$EasterDate) $FroDat = _DateAdd( 'd',60,$EasterDate) ;Umstellen auf TT.MM.JJJJ $WFastDate = StringMid($WFastDate,9)&"."&StringMid($WFastDate,6,2)&"."&$year $RosDat = StringMid($RosDat,9)&"."&StringMid($RosDat,6,2)&"."&$year $FastDat = StringMid($FastDat,9)&"."&StringMid($FastDat,6,2)&"."&$year $AschDat = StringMid($AschDat,9)&"."&StringMid($AschDat,6,2)&"."&$year $GrDoDat = StringMid($GrDoDat,9)&"."&StringMid($GrDoDat,6,2)&"."&$year $KarDat = StringMid($KarDat,9)&"."&StringMid($KarDat,6,2)&"."&$year $OSaDat = StringMid($OSaDat,9)&"."&StringMid($OSaDat,6,2)&"."&$year $OSoDat = StringMid($OSoDat,9)&"."&StringMid($OSoDat,6,2)&"."&$year $OMoDat = StringMid($OMoDat,9)&"."&StringMid($OMoDat,6,2)&"."&$year $HiFaDat = StringMid($HiFaDat,9)&"."&StringMid($HiFaDat,6,2)&"."&$year $PfSoDat = StringMid($PfSoDat,9)&"."&StringMid($PfSoDat,6,2)&"."&$year $PfMoDat = StringMid($PfMoDat,9)&"."&StringMid($PfMoDat,6,2)&"."&$year $FroDat = StringMid($FroDat,9)&"."&StringMid($FroDat,6,2)&"."&$year ;Ermitteln nicht von Ostern abhängiger, veränderlicher Feiertage ;Muttertag = 2. Sonntag im Mai ABER wenn Pfingsten = 2.Sonntag im Mai dann ist Muttertag am 1. Sonntag ;Der 2. Sonntag kann nur zw. dem 8. u. 14.5. liegen For $maitag = 8 To 14 If _Weekday($maitag,5,$year) = "Sonntag" Then If $maitag < 10 Then $maitag = "0" & $maitag EndIf $MutterDat = $maitag & "." & "05." & $year If $MutterDat = $PfSoDat Then $MutterDat = _DateAdd( 'd', -7, $year&"/05/"&$maitag) $MutterDat = _DateToNorm($MutterDat) EndIf ExitLoop EndIf Next ;Erntedankfest 1. Sonntag im Oktober (zw. 1. u. 7.10.) For $oktobertag = 1 To 7 If _Weekday($oktobertag,10,$year) = "Sonntag" Then $oktobertag = "0" & $oktobertag $ErnteDat = $oktobertag & "." & "10." & $year ExitLoop EndIf Next ;4.Advent = Sonntag vor 25.12. (zw. 18. u. 24.12.) For $deztag = 18 To 24 If _Weekday($deztag,12,$year) = "Sonntag" Then $4AdvDat = $year & "/12/" & $deztag $3AdvDat = _DateAdd( 'd', -7, $4AdvDat) $2AdvDat = _DateAdd( 'd', -14, $4AdvDat) $1AdvDat = _DateAdd( 'd', -21, $4AdvDat) $TotSoDat = _DateAdd( 'd', -28, $4AdvDat) $BuBDat = _DateAdd( 'd', -32, $4AdvDat) ExitLoop EndIf Next $4AdvDat = StringMid(_DateToNorm($4AdvDat),1,6) $3AdvDat = StringMid(_DateToNorm($3AdvDat),1,6) $2AdvDat = StringMid(_DateToNorm($2AdvDat),1,6) $1AdvDat = StringMid(_DateToNorm($1AdvDat),1,6) $TotSoDat = _DateToNorm($TotSoDat) $BuBDat = _DateToNorm($BuBDat) GUICtrlSetData($L_WFastDate, $WFastDate) GUICtrlSetData($L_RosDat, $RosDat) GUICtrlSetData($L_FastDat, $FastDat) GUICtrlSetData($L_AschDat, $AschDat) GUICtrlSetData($L_GrDoDat, $GrDoDat) GUICtrlSetData($L_KarDat, $KarDat) GUICtrlSetData($L_OSaDat, $OSaDat) GUICtrlSetData($L_OSoDat, $OSoDat) GUICtrlSetData($L_OMoDat, $OMoDat) GUICtrlSetData($L_HiFaDat, $HiFaDat) GUICtrlSetData($L_MutterDat,$MutterDat) GUICtrlSetData($L_PfSoDat, $PfSoDat) GUICtrlSetData($L_PfMoDat, $PfMoDat) GUICtrlSetData($L_FroDat, $FroDat) GUICtrlSetData($L_ErnteDat, $ErnteDat) GUICtrlSetData($L_TotSoDat, $TotSoDat) GUICtrlSetData($L_BuBDat, $BuBDat) GUICtrlSetData($L_1AdvDat,$1AdvDat) GUICtrlSetData($L_2AdvDat,$2AdvDat) GUICtrlSetData($L_3AdvDat,$3AdvDat) GUICtrlSetData($L_4AdvDat,$4AdvDat) EndIf EndIf Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Ende ExitLoop EndSelectWEndExitThe weekday-dedection works with formula from Christian Zeller.The dedection of Easter (basic for most holidays) works with formula from Carl-Friedrich Gauss.If you have ideas that I can do better, I've open ears for it.As attachment: 'Wochen_Feiertag.exe' (135 kB). Please test it.Have funBugFixEdit: I don't find my attachment, what have I done false? I upload it again and hope it will be successful. Edited October 5, 2005 by BugFix Best Regards BugFix Link to comment Share on other sites More sharing options...
Raindancer Posted October 6, 2005 Share Posted October 6, 2005 Your attachment is not visible cause it is an EXE. Attache the Source code. The .au3-File, and anyone will be able to compile it self to an EXE, if needed :-) Cool Script dude... Say: "Chuchichäschtli"My UDFs:_PrintImage UDF_WinAnimate UDFGruess Raindancer Link to comment Share on other sites More sharing options...
ReFran Posted October 6, 2005 Share Posted October 6, 2005 After I integrated the stated _functions it's works very good. I did it sometime ago with a spreadsheet macro, because I need it to fix company reporting due dates. But I can't remember that there were so much holidays. Must be the difference between the more northern parts and the southern part of Germany. I should remove. Thanks for the script. Keep on, Reinhard Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now