wreckage Posted January 22, 2014 Posted January 22, 2014 Hello. Is it possible to create a compiled application using AutoIT which displays the date and time in a user/configurable format that is able to be copied and then pasted anywhere? Ideally, I'd like an application that pastes the current date and time into virtually any text field by way of a hot-key, but a manual copy/paste would be sufficient. BTW, if anybody knows of a Windows 7 program which does this already, I'd be very grateful. Thanks.
Faalamva Posted January 22, 2014 Posted January 22, 2014 Hi, You can easily display the system date and time using these macros : http://www.autoitscript.com/autoit3/docs/macros/TimeAndDate.htm And build whatever interface you want with it. Example : MsgBox(0, "", @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
Malkey Posted January 23, 2014 Posted January 23, 2014 Here is an example using hotkeys or a tray menu to send or paste a date time formated text. Using a date/time format of your choosing. expandcollapse popup#NoTrayIcon #include <MsgBoxConstants.au3> #include <Date.au3> Global $sFormat = "dddd, MM-dd-yyyy hh:mm:ss tt" HotKeySet("^!{ESC}", "Terminate") ; Ctrl-Alt-Esc HotKeySet("^!t", "_DateTime") ; Ctrl-Alt-t (Send current date time.) HotKeySet("^!f", "_FormatDateTime") ; Ctrl-Alt-f (Format date-time) Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. Example() Func Example() Local $iSettings = TrayCreateItem("Settings") Local $iAbout = TrayCreateItem("About") Local $iCopy = TrayCreateItem("Date Time to clipboard.") TrayCreateItem("") ; Create a separator line. Local $iExit = TrayCreateItem("Exit") TraySetState(1) ; Show the tray menu. While 1 Switch TrayGetMsg() Case $iAbout ; Display a message box about the AutoIt version and installation path of the AutoIt executable. MsgBox($MB_SYSTEMMODAL, "", "Send Formated Date Time." & @CRLF & @CRLF & _ "Hot key: Ctrl-Alt-Esc (End this script) " & @CRLF & _ "Hot key: Ctrl-Alt-t (Send current date time.)" & @CRLF & _ "Hot key: Ctrl-Alt-f (Format date-time)") Case $iSettings _FormatDateTime() Case $iCopy Local $tDate = _Date_Time_GetLocalTime() Local $SYSDate = _Date_Time_SystemTimeToDateTimeStr($tDate, 1) ClipPut(_DateFormat($SYSDate, $sFormat)) Case $iExit ; Exit the loop. ExitLoop EndSwitch WEnd EndFunc ;==>Example Func _FormatDateTime() Local $sFormatNew = InputBox("Date Time Format", "Existing format is:-" & @CRLF & $sFormat, $sFormat) If @error = 0 Then $sFormat = $sFormatNew EndFunc ;==>_FormatDateTime Func _DateTime() Local $tDate = _Date_Time_GetLocalTime() Local $SYSDate = _Date_Time_SystemTimeToDateTimeStr($tDate, 1) Send(_DateFormat($SYSDate, $sFormat)) EndFunc ;==>_DateTime Func Terminate() Exit EndFunc ;==>Terminate ; Format date ; $sDate, input date in the format yyyy/MM/dd[ hh:mm:ss] Func _DateFormat($sDate, $sFormat) $hGui = GUICreate("") $idDate = GUICtrlCreateDate($sDate, 10, 10) GUICtrlSendMsg($idDate, 0x1032, 0, $sFormat) ; or "dddd, MMMM d, yyyy hh:mm:ss tt"); or "hh:mm tt" $FormatedDate = GUICtrlRead($idDate) GUIDelete($hGui) Return $FormatedDate EndFunc ;==>_DateFormat
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