"Inputting" GUI input into a program

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Tmartyn
Posts: 1
Joined: 10 Jan 2020, 00:49

"Inputting" GUI input into a program

10 Jan 2020, 01:23

Hi Guys, new here, yay.

I've done a smattering of coding over the years but I'm really first encountering a lot of the language in AHK while trying to learn how to use it. Like a lot of people I learn by doing not reading >.<

I'm attempting to setup a GUI which will work as follows..
  • Person types #AHK into a text box in a program.
  • GUI window pops up.
  • Person reads instructions , types some things into certain Input Boxes in the GUI, presses GUI button.
  • Text is printed into the original text box, including the text put in the Input Box.
I hope that makes sense.

So far I've been able create input in other hotkeys, as well as making the gui and the buttons, but I can't work out how to take the text from the input box and put it into the text.
User avatar
TheDewd
Posts: 1513
Joined: 19 Dec 2013, 11:16
Location: USA

Re: "Inputting" GUI input into a program

10 Jan 2020, 09:08

Try this:

Code: Select all

#SingleInstance, Force
#Persistent

Gui, Margin, 10, 10
Gui, Add, Edit, w200 r1 vEdit1
Gui, Add, Edit, w200 r1 vEdit2
Gui, Add, Edit, w200 r1 vEdit3
Gui, Add, Edit, w200 r1 vEdit4
Gui, Add, Edit, w200 r1 vEdit5
Gui, Add, Button, w200 r1 gSubmitForm, OK
Gui, Show, Hide Autosize, Example
return

SubmitForm:
	Gui, Submit
	Str := "Field 1: " Edit1 "`nField 2: " Edit2 "`nField 3: " Edit3 "`nField 4: " Edit4 "`nField 5: " Edit5
	Send, % Str
return

:*:#AHK::
	Gui, Show
return
hamsolo474
Posts: 1
Joined: 04 Jan 2022, 03:39

Re: "Inputting" GUI input into a program

04 Jan 2022, 03:45

In order to get this code to run as soon as the script is opened i had to change one line, however you can run the original by typing #AHK

Code: Select all

#SingleInstance, Force
#Persistent

Gui, Margin, 10, 10
Gui, Add, Edit, w200 r1 vEdit1
Gui, Add, Edit, w200 r1 vEdit2
Gui, Add, Edit, w200 r1 vEdit3
Gui, Add, Edit, w200 r1 vEdit4
Gui, Add, Edit, w200 r1 vEdit5
Gui, Add, Button, w200 r1 gSubmitForm, OK
Gui, Show, Hide Autosize, Example
Gui, Show
return

SubmitForm:
	Gui, Submit
	Str := "Field 1: " Edit1 "`nField 2: " Edit2 "`nField 3: " Edit3 "`nField 4: " Edit4 "`nField 5: " Edit5
	Send, % Str
return

:*:#AHK::
	Gui, Show
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: OrangeCat and 294 guests