0
votes

I have this little script which is sort of an experiment with the GUI. However, when I try to enter data and then display it in a text box, it don't work. Does anyone have any idea why?

#SingleInstance force
SetDefaultMouseSpeed, 10

Gui, Add, Text,, First Name:
Gui, Add, Text,, Middle Name:
Gui, Add, Text,, Last Name:
Gui, Add, Text,, Street 1:
Gui, Add, Text,, Street 2:
Gui, Add, Text,, City:
Gui, Add, Text,, State:
Gui, Add, Text,, Zip:
Gui, Add, Text,, Phone:
Gui, Add, Edit, vFirstName ym
Gui, Add, Edit, vMiddleName
Gui, Add, Edit, vLastName
Gui, Add, Edit, vStreet1
Gui, Add, Edit, vStreet2
Gui, Add, Edit, vCity
Gui, Add, Edit, vState
Gui, Add, Edit, vZip
Gui, Add, Edit, vPhone
Gui, Add, Button, x124 y260 w54 h26 default , OK
Gui, Add, Button, x40 y260 w54 h26 , Cancel
; Generated using SmartGUI Creator 4.0
Gui, Show
return

ButtonCancel:
ExitApp
return

GuiClose:
ButtonOK:
Gui, Submit  ; Save the input from the user to each control's associated variable.
MsgBox %vFirstName% %vMiddleName% %vLastName%
ExitApp
1

1 Answers

0
votes

It looks like you are referring to your variables incorrectly in the MsgBox.

On your GUI lines you are using the v prefix correctly. However, this prefix is not included in the variable name. Your Msgbox line should look like this:

MsgBox %FirstName% %MiddleName% %LastName%

To troubleshoot in the future, you can doubleclick on your AHK icon in the tray and go to View -> Variables and contents or run the Listvars command.