Sending Date from GUI in Certain Format

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dmax52
Posts: 4
Joined: 25 Jul 2021, 13:18

Sending Date from GUI in Certain Format

Post by dmax52 » 25 Jul 2021, 13:25

I am trying to <Send> a date that was stored as a variable from a GUI date selector.

The GUI line is as follows: <Gui, Add, DateTime, vSD, MM/dd/yyyy>

For the line <Send vSD>, the script sends the date in the YYYYMMDDHH24MISS format.

Is there a way to send the date in the MM/dd/yyyy format?

Thank you.

User avatar
mikeyww
Posts: 26883
Joined: 09 Sep 2014, 18:38

Re: Sending Date from GUI in Certain Format

Post by mikeyww » 25 Jul 2021, 13:48

Code: Select all

Gui, Font, s10
Gui, Add, DateTime, vSD, MM/dd/yyyy
Gui, Add, Button, x+m Default, OK
Gosub, F3
F3::
uid := WinActive("A")
Gui, Show,, Select a date
Return
ButtonOK:
Gui, Submit
FormatTime, date, %SD%, MM/dd/yyyy
WinActivate, ahk_id %uid%
Send {Text}%date%
Return
GuiEscape:
GuiClose:
Gui, Hide
Return

dmax52
Posts: 4
Joined: 25 Jul 2021, 13:18

Re: Sending Date from GUI in Certain Format

Post by dmax52 » 25 Jul 2021, 20:34

mikeyww wrote:
25 Jul 2021, 13:48

Code: Select all

Gui, Font, s10
Gui, Add, DateTime, vSD, MM/dd/yyyy
Gui, Add, Button, x+m Default, OK
Gosub, F3
F3::
uid := WinActive("A")
Gui, Show,, Select a date
Return
ButtonOK:
Gui, Submit
FormatTime, date, %SD%, MM/dd/yyyy
WinActivate, ahk_id %uid%
Send {Text}%date%
Return
GuiEscape:
GuiClose:
Gui, Hide
Return
Thank you! I was using the date format but did not figure to put the variable in between %%.

Post Reply

Return to “Ask for Help (v1)”