c.haslam Posted February 22, 2008 Share Posted February 22, 2008 Is there a way of getting AutoIt to return the short date format in use on a computer? ...chris Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
icadea Posted February 22, 2008 Share Posted February 22, 2008 yes, there is a variety of options. look for _DateTimeFormat in the help files. Link to comment Share on other sites More sharing options...
c.haslam Posted February 22, 2008 Author Share Posted February 22, 2008 Thank you for your reply.I rephrase my question:GUICtrlCreateDate with $DTS_SHORTDATEFORMAT returns a date in my PC's short-date formatOn my PC, I have set the short date format to yyyy-mm-ddUsing StringSplit, my code separates out year, month and dayI give the script to a friend whose short-date format is different, e.g. mm-dd-yyyySo my code mixes up year, month and daySo my code needs know what format a PC is using.How do I get a PC's short-date format so there will be no mixe up in my code?...chris Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
icadea Posted February 22, 2008 Share Posted February 22, 2008 If you could post your code, there are people who could see what is wrong and point you to the right direction. Link to comment Share on other sites More sharing options...
GaryFrost Posted February 23, 2008 Share Posted February 23, 2008 (edited) _GUICtrlDTP_GetSystemTime Edited February 23, 2008 by GaryFrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
c.haslam Posted February 25, 2008 Author Share Posted February 25, 2008 Here is a script excerpted from a much longer script that shows what I need to do: CODE#include <GUIConstants.au3> Global $dlgXCopy = GUICreate("XCopy", 588, 705, -1,-1) ; centred Global $inpDate = GUICtrlCreateDate("", 144, 232, 81, 25, $WS_TABSTOP) Global $btnExecute = GUICtrlCreateButton("Execute", 520, 672, 57, 25, 0) Global $btnCancel = GUICtrlCreateButton("Cancel", 434, 672, 57, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE,$btnCancel ExitLoop Case $btnExecute DoExecute() EndSwitch WEnd GUIDelete() Func DoExecute() $t = GUICtrlRead($inpDate) ; need to replace this with call to function that returns ; setting in Control Panel | REgional Options | Date $dateformat = "yyyy-mm-dd" Switch $dateformat Case "yyyy-mm-dd" $ar = StringSplit($t,"-",0) ; characters $mon = $ar[2] $day = $ar[3] $yr = $ar[1] Case "mm/dd/yyyy" $ar = StringSplit($t,"/",0) ; characters $mon = $ar[1] $day = $ar[2] $yr = $ar[3] Case Else ; other date formats EndSwitch MsgBox(0,"","mon "&$mon&" day "&$day&" year "&$yr) EndFunc The Date control should offer the user the date format his PC is using, not force him to use a format the script dictates. Sorry about the lack of indents. The script has them in SciTe, but not here. ...chris Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard Link to comment Share on other sites More sharing options...
GaryFrost Posted February 25, 2008 Share Posted February 25, 2008 #include <GUIConstantsEx.au3> #include <GuiDateTimePicker.au3> #include <WindowsConstants.au3> Global $dlgXCopy = GUICreate("XCopy", 588, 705, -1, -1) ; centred Global $inpDate = GUICtrlCreateDate("", 144, 232, 81, 25, $WS_TABSTOP) Global $btnExecute = GUICtrlCreateButton("Execute", 520, 672, 57, 25, 0) Global $btnCancel = GUICtrlCreateButton("Cancel", 434, 672, 57, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $btnCancel ExitLoop Case $btnExecute DoExecute() EndSwitch WEnd GUIDelete() Func DoExecute() $aDate = _GUICtrlDTP_GetSystemTime(GUICtrlGetHandle($inpDate)) $mon = $aDate[1] $day = $aDate[2] $yr = $aDate[0] MsgBox(0, "", "mon " & $mon & " day " & $day & " year " & $yr) EndFunc ;==>DoExecute SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
c.haslam Posted February 25, 2008 Author Share Posted February 25, 2008 Many thanks ...chris Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard 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