How To Change The Text Of Multiple Text Boxes Using GuiControl Or ControlSetText

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
roonyrooxcess
Posts: 61
Joined: 20 Nov 2020, 21:29

How To Change The Text Of Multiple Text Boxes Using GuiControl Or ControlSetText

07 May 2021, 04:02

Hi, i'm trying to change the text of multiple Text boxes in a gui, but cant figure out how to specify which text box using guicontrol ...

I'm trying to change the Bananas into apples & the Carrots into pears

Code I'm testing ...

Code: Select all

#SingleInstance, Force

Gui, Add, Text,x0 y0,  Banana 1
Gui, Add, Text,x0 y20, Banana 2
Gui, Add, Text,x0 y40, Banana 3
Gui, Add, Text,x0 y60, Banana 4

Gui, Add, Text,x0 y80, Carrot 1
Gui, Add, Text,x0 y100, Carrot 2
Gui, Add, Text,x0 y120, Carrot 3
Gui, Add, Text,x0 y140, Carrot 4

Gui, Show,h200 x1600 y100



GuiControl,,x0 y0,  apple 1
GuiControl,,x0 y20, apple 2
GuiControl,,x0 y40, apple 3
GuiControl,,x0 y60, apple 4

GuiControl,,x0 y80,  pear 1
GuiControl,,x0 y100, pear 2
GuiControl,,x0 y120, pear 3
GuiControl,,x0 y140, pear 4




esc::
{

sleep 100
Send {LControl down}
sleep 100
Send {s}
sleep 100
Send {LControl up}

Reload
}
Return
Rohwedder
Posts: 7647
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How To Change The Text Of Multiple Text Boxes Using GuiControl Or ControlSetText

07 May 2021, 04:23

Hallo,
try:

Code: Select all

#SingleInstance, Force

Gui, Add, Text,x0 y0 vY0,  Banana 1
Gui, Add, Text,x0 y20 vY20, Banana 2
Gui, Add, Text,x0 y40 vY40, Banana 3
Gui, Add, Text,x0 y60 vY60, Banana 4

Gui, Add, Text,x0 y80 vY80, Carrot 1
Gui, Add, Text,x0 y100 vY100, Carrot 2
Gui, Add, Text,x0 y120 vY120, Carrot 3
Gui, Add, Text,x0 y140 vY140, Carrot 4

Gui, Show,h200 x1600 y100

Sleep, 2000

GuiControl,,Y0,  apple 1
GuiControl,,Y20, apple 2
GuiControl,,Y40, apple 3
GuiControl,,Y60, apple 4

GuiControl,,Y80,  pear 1
GuiControl,,Y100, pear 2
GuiControl,,Y120, pear 3
GuiControl,,Y140, pear 4




esc::
{

sleep 100
Send {LControl down}
sleep 100
Send {s}
sleep 100
Send {LControl up}

Reload
}
Return
roonyrooxcess
Posts: 61
Joined: 20 Nov 2020, 21:29

Re: How To Change The Text Of Multiple Text Boxes Using GuiControl Or ControlSetText

07 May 2021, 04:33

Hi, thats great, but when i try to change the x axis, nothing happens ...

Code: Select all

#SingleInstance, Force

Gui, Add, Text,x10 y0 vY0,  Banana 1
Gui, Add, Text,x20 y20 vY20, Banana 2
Gui, Add, Text,x30 y40 vY40, Banana 3
Gui, Add, Text,x40 y60 vY60, Banana 4

Gui, Add, Text,x0 y80 vY80, Carrot 1
Gui, Add, Text,x0 y100 vY100, Carrot 2
Gui, Add, Text,x0 y120 vY120, Carrot 3
Gui, Add, Text,x0 y140 vY140, Carrot 4

Gui, Show,h200 x1600 y100

Sleep, 2000

GuiControl,,X10 Y0,  apple 1
GuiControl,,X20 Y20, apple 2
GuiControl,,X30 Y40, apple 3
GuiControl,,X40 Y60, apple 4

GuiControl,,Y80,  pear 1
GuiControl,,Y100, pear 2
GuiControl,,Y120, pear 3
GuiControl,,Y140, pear 4




esc::
{

sleep 100
Send {LControl down}
sleep 100
Send {s}
sleep 100
Send {LControl up}

Reload
}
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk, Spawnova, toddhere, USS_Sandhu and 308 guests