Help Using InputBox Text As a ListBox Choice
Posted: 22 Jan 2022, 21:01
I have a listbox with a bunch of choices. But I want to be able to add another choice using a inputbox.
Here's the relevant part of my code:
Here's the relevant part of my code:
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Gui Add, ListBox, wp hp Multi VCalendar , Sam Smith|John Doe|Sammy Sosa|Alex Brown|INPUT
Gui, Show,, Test
Gui Font
Gui Add, Button, x1300 y560 w75 h23 gCalendarRun, Calendar
Calendar:
if A_GuiControlEvent <> DoubleClick
return
GuiControlGet, Client ; Retrieve the ListBox's current selection.
Sleep, 200
SendInput, %Calendar%
Gui, Submit, Hide
Sleep, 200
SendInput, %Calendar%
Gui, Hide
Return
CalendarRun:
Gui, Submit, Hide
{
If (Calendar=INPUT)
tempVar:=Listbox
}
Else
tempVar:=%Calendar%
Sleep, 1000
Run, Chrome.exe "https://calendar.google.com/calendar/u/1/r/search?q="%tempVar%
Reload
Return