Help how to get button text?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mandus
Posts: 14
Joined: 27 Oct 2016, 01:33
Contact:

Help how to get button text?

15 Nov 2016, 23:20

How can i get the button text?

say for example i have

Code: Select all

Gui Add, Button, x560 y495 w160 h30, Test
how can i retrieve "Test" from the button?
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Help how to get button text?

15 Nov 2016, 23:34

Code: Select all

Gui Add, Button, x560 y495 w160 h30 vBtn, Test
Gui, Show

GuiControlGet, BtnText,, Btn, Text
msgbox % BtnText
for more info see:
GUI Variables
GuiControlGet
mandus
Posts: 14
Joined: 27 Oct 2016, 01:33
Contact:

Re: Help how to get button text?

15 Nov 2016, 23:49

TLM wrote:

Code: Select all

Gui Add, Button, x560 y495 w160 h30 vBtn, Test
Gui, Show

GuiControlGet, BtnText,, Btn, Text
msgbox % BtnText
for more info see:
GUI Variables
GuiControlGet
i am trying to do the same with

Code: Select all

	Gui Add, Button, x830 y161.5 w160 h30 gChartShow_Main15 hwndClr_Btn15 vBtn15, test
	
ChartShow_Main15:
	GuiControlGet, CW_Name15,, Btn15, Text
	msgbox % CW_Name15
i get an empty box
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Help how to get button text?

16 Nov 2016, 07:48

How do you have it setup? When I show the GUI, it works

Code: Select all

Gui Add, Button, x830 y161.5 w160 h30 gChartShow_Main15 hwndClr_Btn15 vBtn15, test
Gui Show
Return

ChartShow_Main15:
GuiControlGet, CW_Name15,, Btn15, Text
msgbox % CW_Name15
Return
For test purposes, it also works without showing the GUI

Code: Select all

Gui Add, Button, x830 y161.5 w160 h30 gChartShow_Main15 hwndClr_Btn15 vBtn15, test

ChartShow_Main15:
GuiControlGet, CW_Name15,, Btn15, Text
msgbox % CW_Name15
mandus
Posts: 14
Joined: 27 Oct 2016, 01:33
Contact:

Re: Help how to get button text?

16 Nov 2016, 13:05

here is my code:
https://github.com/MHketbi/WIP/blob/master/WIP.ahk

line 364 the g-label triggers at start of script for no reason :s

line 314 to 361 i cant get any text.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Xtra and 349 guests