Jump to content

Recommended Posts

Posted (edited)

I have many folders where at month's end or shortly after I lump together the month's files created and move them into a dated subfolder.

The format used for this dated subfolder keeps these in order as I use exclusively use the details view in Windows Explorer.

The format is:

"yyyy.mm - mmm yyyy"

to achieve this:

"2026.07 - JUL 2026"

 

I have no idea how to accomplish a simple maybe, what would it be called, perhaps a pulldown sort of script to achieve this type of date format.

What does anyone recommend.  I'm guessing a pulldown box for month and year selected once to then derive the 2 styles of dates in:

yyyy.mm - mmm yyyy

 

The dircreate can then be added to further automate this.  That would be grand.

Thanks in advance for any guidance.

:)

Edited by Diana (Cda)
Posted (edited)

Would something like this do the trick?

#include <date.au3>
#include <GuiMonthCal.au3>
#include <GuiConstants.au3>
#include <WindowsConstants.au3>

Global Const $MCMV_MONTH = 0
Global Const $MCMV_YEAR = 1
Global Const $MCMV_DECADE = 2
Global Const $MCMV_CENTURY = 3

Global Const $tagNMVIEWCHANGE = "struct;" & $tagNMHDR & ";dword OldView; dword NewView; endstruct"

Global $idDateLab

_Example()

Func _Example()
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    Local $hGUI = GUICreate("", 245, 191)
    Local $hCalPicker = _GUICtrlMonthCal_Create($hGUI, 10, 10, $MCS_NOTODAY)
    $idDateLab = GUICtrlCreateLabel("", 10, 160, 225, 21, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN))
    _SendMessage($hCalPicker, $MCM_SETCURRENTVIEW, 0, $MCMV_YEAR)

    GUISetState()

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    GUIDelete()
    GUIRegisterMsg($WM_NOTIFY, "")

EndFunc   ;==>_Example


Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)

    Switch _WinAPI_GetClassName($tNMHDR.hWndFrom)
        Case $WC_MONTHCAL
            Switch $tNMHDR.Code
                Case $MCN_VIEWCHANGE
;~                  Local $tNMViewCng = DllStructCreate($tagNMVIEWCHANGE, $lParam)
                    _SendMessage($tNMHDR.hWndFrom, $MCM_SETCURRENTVIEW, 0, $MCMV_YEAR)

                Case $MCN_SELCHANGE
                    Local $tNMSelCng = DllStructCreate($tagNMSELCHANGE, $lParam)
                    Local $sShortMon = _DateToMonth($tNMSelCng.BegMonth, $DMW_SHORTNAME)

                    Local $sText = StringFormat("%d.%02d - %s %d", $tNMSelCng.BegYear, $tNMSelCng.BegMonth, StringUpper($sShortMon), $tNMSelCng.BegYear)
                    GUICtrlSetData($idDateLab, $sText)
                    ConsoleWrite($sText & @CRLF)

            EndSwitch
    EndSwitch

EndFunc   ;==>WM_NOTIFY

Edit: added $MCS_NOTODAY picker style.

Edited by MattyD

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...