Sending output of date selector

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
richd1
Posts: 1
Joined: 24 May 2024, 04:35

Sending output of date selector

24 May 2024, 04:41

I am trying to create a date selector box with version 2 but cant seem to figure out how to send the input from what is selected to where I am typing (notepad or word document)

This is my code so far as best as I could figure out from searching the internet. Can someone help me fix the code.

Code: Select all

!d::

{

MyGui := Gui(, "Date")

MyGui.AddMonthCal("vMonthCalendar")

MyGui.Add("Button", "default", "OK").OnEvent("Click", ProcessUserInput)

MyGui.OnEvent("Close", ProcessUserInput)

MyGui.Show()

 

ProcessUserInput(*)

{

  Saved := MyGui.Submit()

}

}

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]

[Mod action: Moved post from a very loosely related thread (about a function for bolding holidays in a date selector box) to its own thread.]
User avatar
boiler
Posts: 17404
Joined: 21 Dec 2014, 02:44

Re: Sending output of date selector

24 May 2024, 05:11

You can change the MsgBox to Send or whatever you want to do with the result.

Code: Select all

#Requires AutoHotkey v2.0

MyGui := Gui(, "Date")
MyGui.AddMonthCal("vMonthCalendar")
MyGui.Add("Button", "default", "OK").OnEvent("Click", ProcessUserInput)
MyGui.OnEvent("Close", ProcessUserInput)

!d::MyGui.Show()

ProcessUserInput(*)
{
  Saved := MyGui.Submit()
  MsgBox Saved.MonthCalendar
}
User avatar
kunkel321
Posts: 1194
Joined: 30 Nov 2015, 21:19

Re: Sending output of date selector

24 May 2024, 07:42

Added to Boilers, to make Enter key also enter the date.

Code: Select all

#SingleInstance
#Requires AutoHotkey v2.0

MyGui := Gui(, "Date")
MyGui.AddMonthCal("vMonthCalendar")
MyGui.Add("Button", "default", "OK").OnEvent("Click", ProcessUserInput)
MyGui.OnEvent("Close", ProcessUserInput)

!d::MyGui.Show()

#HotIf WinActive("Date") ; Only when caldendar gui is showing
Enter:: ; Press enter to choose date.
ProcessUserInput(*)
{
  Saved := MyGui.Submit()
  MsgBox formatTime(Saved.MonthCalendar, "MM/dd/yyyy")
}
#HotIf
ste(phen|ve) kunkel

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: billyt, bobstoner289, Draken and 66 guests