Jump to content

Recommended Posts

Posted

Hello,

I'm new to AutoIt...

I´m a bit lost. :( ... Is there any way to extract the month from the date and time picker?

I created a dtpicker:

$date_now = @MDAY&"-"&@MON&"-"&@YEAR

$MonthCal1 = GUICtrlCreateMonthCal($date_now, 16, 16, 193, 180)

When the user chooses a different date, i want to read it, and, if possible, i want the values seperatly. (day - month - year).

I spent several hours :sweating: trying to find the answer, and this can't be so difficult i guess. (This is very simple in VB..)

Anyone???

Thanks in advance, and sorry for the poor english.

Best regards,

Rody

Posted

Hello (hallo) Jos,

Bedankt voor je reactie.

Ja, heb ik gedaan, dat werkt ook wel, maar hoe haal ik de maand uit de datum??

Voel me lullig dit te moeten vragen overigens. Ben nog nooit echt met auto it bezig geweest, nu probeer ik het weer een beetje op te pakken, maar dat kost zo meer tijd dan ik er mee ga besparen.....

Gr,

Rody

  • Developers
Posted

Something to play with:

#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $Date, $msg
    GUICreate("Get date", 210, 190)

    $Date = GUICtrlCreateMonthCal("1953/03/25", 10, 10)
    GUISetState()

    ; Run the GUI until the dialog is closed or timeout

    Do
        $msg = GUIGetMsg()
    Until $msg = $GUI_EVENT_CLOSE

    ConsoleWrite('Returned Date = ' & GUICtrlRead($Date) & @CRLF)
    $adate = StringSplit(GUICtrlRead($Date), "/")
    ConsoleWrite(" Year=" & $adate[1] & @CRLF)
    ConsoleWrite(" Month=" & $adate[2] & @CRLF)
    ConsoleWrite(" Day=" & $adate[3] & @CRLF)

EndFunc   ;==>Example

Jos ;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Hello Jos,

Thanks a lot. I see you split the "string". There is no other function available in AutoIt to do this like in VB?

This will help me a lot by the way, thanks for sharing.

Best regards, (met vriendelijke groet),

Rody

  • Developers
Posted (edited)

Sure there are many other options:

_StringBetween()

StringRegExp()

StringInstr() + StringMid()

..but just used this one this time as it seemed to be the easiest one, which by the way is also available in VB (SPLIT()) :)

Groet,

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...