Help with edit and v-label

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
6fce01
Posts: 1
Joined: 19 Jul 2020, 04:40

Help with edit and v-label

19 Jul 2020, 05:04

Code: Select all

#InstallKeybdHook
#UseHook

gui, add, edit, x20 y30 w400 h20 vSlot1
gui, add, edit, x20 y70 w400 h20 vSlot2
gui, add, Button, x500 y30 w50 h20, OK
Gui, Show, w600 h500, TEST
return

ButtonOK:
	gui, submit, NoHide
	return
	
GuiClose:
ExitApp

$numpad1::
	send %Slot1%

$numpad2::
	send %Slot2%
Hi, I'm trying to write a script that store values of each edit box to separate variables, then prints them with numpad hotkeys.
But when I run the script, the first hotkey prints Slot 1 and Slot 2 at the same time, when it should only print Slot 1.
For example, if the input of Slot 1 is HELLO, and Slot 2 is HI, numpad1 prints out HELLOHI. But numpad2 works fine, only printing out Slot 2.
I'm new to AHK, and I have no idea whats going on. Please help
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Help with edit and v-label

19 Jul 2020, 05:41

Code: Select all

$numpad1::        ; multiple line hotkey
	send %Slot1%
    Return
        
$numpad1::Send %Slot2%   ; single line hotkey        
User avatar
Maestr0
Posts: 136
Joined: 05 Dec 2013, 17:43

Re: Help with edit and v-label

19 Jul 2020, 05:45

6fce01 wrote:
19 Jul 2020, 05:04

Code: Select all

#InstallKeybdHook
#UseHook

gui, add, edit, x20 y30 w400 h20 vSlot1
gui, add, edit, x20 y70 w400 h20 vSlot2
gui, add, Button, x500 y30 w50 h20, OK
Gui, Show, w600 h500, TEST
return

ButtonOK:
	gui, submit, NoHide
	return
	
GuiClose:
ExitApp

$numpad1::
	send %Slot1%

$numpad2::
	send %Slot2%
Hi, I'm trying to write a script that store values of each edit box to separate variables, then prints them with numpad hotkeys.
But when I run the script, the first hotkey prints Slot 1 and Slot 2 at the same time, when it should only print Slot 1.
For example, if the input of Slot 1 is HELLO, and Slot 2 is HI, numpad1 prints out HELLOHI. But numpad2 works fine, only printing out Slot 2.
I'm new to AHK, and I have no idea whats going on. Please help
Hi there and welcome!

There is an issue with your code, important but small. Please see below my commented code changes of yours. Line 20 is the part where you went wrong, I think.
If you have any questions, let us know by replying here.

Code: Select all

#InstallKeybdHook
#UseHook

gui, add, edit, x20 y30 w400 h20 vSlot1, 
gui, add, edit, x20 y70 w400 h20 vSlot2, 
gui, add, Button, x500 y30 w50 h20, OK
Gui, Show, w600 h500, TEST
return

ButtonOK:
	gui, submit, NoHide
	return
	
GuiClose:
ExitApp

$numpad1::
	gui, submit, NoHide ; we can put it here, so we can use the new texts immediately
	send %Slot1%
return ; if you have the commands of the hotstring below the line, then you need to close it off with a return

$numpad2::send %Slot2% ; or, if it's on one line, you don't need to specify the return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], jollyjoe and 288 guests