#include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Date.au3> #NoTrayIcon Global $sExcludeDates = FileRead(@ScriptDir & '\Dates.txt') $sExcludeDates = StringRegExpReplace($sExcludeDates, '(\d\d)\.(\d\d)\.(\d\d\d\d)', '\3/\2/\1') GUICreate("DateCalc", 470, 250) Global $sDateBegin = @YEAR & '/' & @MON & '/' & @MDAY Global $sDateEnd = CalcDateEnd($sDateBegin) Global $MonthCal1Begin = GUICtrlCreateMonthCal($sDateBegin, 62, 32) Global $MonthCal1End = GUICtrlCreateMonthCal($sDateEnd, 250, 32) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MonthCal1Begin $sDateBegin = GUICtrlRead($MonthCal1Begin, 0) $sDateEnd = CalcDateEnd($sDateBegin) GUICtrlSetData($MonthCal1End, $sDateEnd) EndSwitch WEnd Func CalcDateEnd($sDate) Local $i For $i = 1 To 40 $sDate = _DateAdd('d', 1, $sDate) While StringInStr($sExcludeDates, $sDate) $sDate = _DateAdd('d', 1, $sDate) WEnd Next Return $sDate EndFunc ;==>CalcDateEnd |