GUI help Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
IWantItAll2
Posts: 8
Joined: 14 Jun 2023, 10:00

GUI help

14 Jun 2023, 10:13

Im having an issue where i cant access my variables in my gui controls, Im pretty new to AHK but this issue is beating me.
i just want to send the value of my edit box as keys. but im told that it never gets assigned a value.
Im sure this is a simple mistake im making but i cant work it out.
TIA

Code: Select all

; Language:       English
; Platform:       Win10

myGUI :=Gui()

	myGUI.Add("Text", "Right Section xs w100", "login")
	myGUI.Add("Edit", "vMyVar")
	myGUI.Add("upDown", "Range1-10", "5")
	myGUI.Add("Button", "Default w80 ys", "SEND").OnEvent("Click", BT_click)
	
myGUI.Show()

BT_click(*)
{
	myGUI.submit(0) ;get variable values
	send %MyVar%	
	return
}
User avatar
boiler
Posts: 17390
Joined: 21 Dec 2014, 02:44

Re: GUI help  Topic is solved

14 Jun 2023, 11:25

Here it is with a MsgBox. I'm not sure where you expect Send to send it since it doesn't appear that an appropriate place to send it would be active at the time. It just sends it right back to where it pulled it from.

Code: Select all

BT_click(*)
{
	Saved := myGUI.submit(0) ;get variable values
	MsgBox Saved.MyVar	
}
sashaatx
Posts: 351
Joined: 27 May 2021, 08:27
Contact:

Re: GUI help

14 Jun 2023, 11:28

IWantItAll2 wrote:
14 Jun 2023, 10:13
Im having an issue where i cant access my variables in my gui controls, Im pretty new to AHK but this issue is beating me.
i just want to send the value of my edit box as keys. but im told that it never gets assigned a value.
Im sure this is a simple mistake im making but i cant work it out.
TIA
https://www.autohotkey.com/docs/v2/lib/Gui.htm#Submit

Code: Select all

myGUI :=Gui()

	myGUI.Add("Text", "Right Section xs w100", "login")
	myGUI.Add("Edit", "vMyVar")
	myGUI.Add("upDown", "Range1-10", "5")
	myGUI.Add("Button", , "SEND").OnEvent("Click", BT_click)
	
myGUI.Show()

BT_click(*)
{
	value_storage := myGUI.submit()  ; https://www.autohotkey.com/docs/v2/lib/Gui.htm#Submit
	MsgBox(value_storage.MyVar)
	return
}
Last edited by sashaatx on 14 Jun 2023, 11:30, edited 1 time in total.
https://github.com/samfisherirl
? /Easy-Auto-GUI-for-AHK-v2 ? /Useful-AHK-v2-Libraries-and-Classes : /Pulovers-Macro-Creator-for-AHKv2 :
sashaatx
Posts: 351
Joined: 27 May 2021, 08:27
Contact:

Re: GUI help

14 Jun 2023, 11:29

boiler wrote:
14 Jun 2023, 11:25
Here it is with a MsgBox. I'm not sure where you expect Send to send it since it doesn't appear that an appropriate place to send it would be active at the time. It just sends it right back to where it pulled it from.

Code: Select all

BT_click(*)
{
	Saved := myGUI.submit(0) ;get variable values
	MsgBox Saved.MyVar	
}
beat me by a second
https://github.com/samfisherirl
? /Easy-Auto-GUI-for-AHK-v2 ? /Useful-AHK-v2-Libraries-and-Classes : /Pulovers-Macro-Creator-for-AHKv2 :
IWantItAll2
Posts: 8
Joined: 14 Jun 2023, 10:00

Re: GUI help

15 Jun 2023, 02:25

boiler wrote:
14 Jun 2023, 11:25
Here it is with a MsgBox. I'm not sure where you expect Send to send it since it doesn't appear that an appropriate place to send it would be active at the time. It just sends it right back to where it pulled it from.

Code: Select all

BT_click(*)
{
	Saved := myGUI.submit(0) ;get variable values
	MsgBox Saved.MyVar	
}
Thanks! that's got it working.
I striped some code out that wasn't important, I had a winActivate on another window to dump the text into.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Draken, emp00 and 42 guests