[Dialog/Function] SelectTimeFormat

Post your working scripts, libraries and tools
User avatar
Delta Pythagorean
Posts: 574
Joined: 13 Feb 2017, 13:44
GitHub: DelPyth
Location: Somewhere in the US

[Dialog/Function] SelectTimeFormat

08 Oct 2018, 18:51

Just a little something for the user to select a custom format for a date and time.

Here's the function:

Code: Select all

SelectTimeFormat(Hwnd, CustomFormats := "") {
	Gui, DS:New, -MinimizeBox +Owner%Hwnd% +hwndDS
	Gui, DS:Add, ListBox, w330 h120 hwndType g__DS_LB, M/dd/yyyy h:mm:ss tt||dddd, MMMM dd, yyyy|dd-MMM-yy|m/dd/yyyy|h:mm:ss tt|h:mm tt|HH:mm|%CustomFormats%
	Gui, DS:Add, Button, w75 h23 g__DS_Format, &OK
	Gui, DS:Show,, Date Format Select
	WinWaitClose, % "ahk_id " DS
	Return, Time

		If (A_GuiEvent ~= "i)Double") || (A_ThisLabel ~= "i)Format") {
			Gui, DS:Submit
			GuiControlGet, Type,, % Type
			FormatTime, Time,, % Type

And here's an example:

Code: Select all

; > Performance Header Begin::
#SingleInstance, Force
#KeyHistory, 0
#MaxThreadsPerHotkey, 1
ListLines, Off
SendMode, Input
SetBatchLines, -1
SetWinDelay, -1
SetMouseDelay, -1
SetKeyDelay, -1, -1
SetTitleMatchMode, 2
DetectHiddenWindows, Off
SetWorkingDir, % A_ScriptDir
; > Performance Header End::

Gui, 1:New, -MinimizeBox +HwndHwnd
Gui, 1:Add, Text, w200 vInfo, ----
Gui, 1:Add, Button, w75 h23, Select
Gui, 1:Show,, Date Select

	GuiControl, 1:, Info, % SelectTimeFormat(Hwnd)


#Include, SelectTimeFormat.ahk

- [AHK].......: Unicode 64-bit
- [OS].........: Windows 10.0.19041
- [GITHUB]...: github.com/DeltaPyth
- [PAYPAL]....: paypal.me/DelPyth
- [DISCORD]..: Tophat Cat // Delta#8888

Remember to use [code]CODE[/code] for your multi-line scripts.
Stay safe, stay inside, and remember to wash your hands for 20 seconds!
Posts: 1446
Joined: 22 Jan 2017, 19:37

Re: [Dialog/Function] SelectTimeFormat

08 Oct 2018, 19:04

@DelPyth, thanks, nice script.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 27 guests