guidok Posted May 11, 2022 Posted May 11, 2022 Hello, I'm looking for a way to get the day of week (numeric or in words) from the return-value of the GUICtrlCreateMonthCal-control. Is such a function present in autoit? Has anyone already written such a function? Or do I have to create this function? Thanks a lot ... Guido
Musashi Posted May 11, 2022 Posted May 11, 2022 Just an example : #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Date.au3> Global $sSelectedDate = _CalendarDaySeletion("2022/05/11") Global $iWeekday = _DateToDayOfWeek(StringMid($sSelectedDate, 1, 4), _ StringMid($sSelectedDate, 6, 2), _ StringMid($sSelectedDate, 9, 2)) MsgBox(0, "Selected", "Date = " & $sSelectedDate & @CRLF & _ "Day = " & $iWeekday & @CRLF & _ "Name = " & _DateDayOfWeek($iWeekday)) ; *** just info Func _CalendarDaySeletion($sDate) Local $hGUI = GUICreate("Select Date", 260, 300) Local $idDate = GUICtrlCreateMonthCal($sDate, 10, 10, 230, 240) Local $idQuit = GUICtrlCreateButton("Quit", 10, 260, 230, 30) Local $sSelected GUISetState(@SW_SHOW) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idQuit ExitLoop EndSwitch WEnd $sSelected = GUICtrlRead($idDate) GUIDelete($hGUI) Return $sSelected EndFunc ;==>_CalendarDaySeletion "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
Moderators JLogan3o13 Posted May 11, 2022 Moderators Posted May 11, 2022 (edited) Something like this perhaps, using the help file example as a start: #include <Date.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("Get date", 210, 190) Local $idDate = GUICtrlCreateMonthCal(_NowDate(), 10, 10) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idDate $dateSplit = StringSplit(GUICtrlRead($idDate), "/") MsgBox($MB_SYSTEMMODAL, "Date", GUICtrlRead($idDate) & " is a " & _DateDayOfWeek(_DateToDayOfWeek($dateSplit[1], $dateSplit[2], $dateSplit[3]))) EndSwitch WEnd EndFunc ;==>Example Edit: Too slow Edited May 11, 2022 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Musashi Posted May 11, 2022 Posted May 11, 2022 2 minutes ago, JLogan3o13 said: Edit: Too slow Now the OP has more than one option "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
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