AutoHotKey GUI无法正常工作

时间:2013-07-16 20:02:44

标签: autohotkey

我有这个小脚本,它是一种GUI实验。但是,当我尝试输入数据然后在文本框中显示它时,它不起作用。有谁知道为什么?

#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 个答案:

答案 0 :(得分:0)

您似乎在MsgBox

中错误地引用了您的变量

在GUI行上,您正确使用v前缀。但是,此前缀不包含在变量名称中。您的Msgbox行应如下所示:

MsgBox %FirstName% %MiddleName% %LastName%

要在将来进行问题排查,您可以双击托盘中的AHK图标,然后转到View -> Variables and contents或运行Listvars命令。