2014-09-30 55 views
0

我对AutoHotKey程序相当陌生。我正在尝试创建一个相当简单的“应用程序”,它让我输入一些细节,然后在msgBox中将它们返回给我。这是我做的:AutoHotKey - GUI提交然后做点什么

#T:: 
Gui, Add, Text, x26 y27 w420 h30 , MAWB: (Udfyld MAWB nummer format: xxx-xxxxxxxx) 
Gui, Add, Edit, x26 y67 w420 h20 mawb, MAWB Nummer 
Gui, Add, Text, x26 y107 w420 h30 , Vælg Handling Agent 
Gui, Add, DropDownList, x26 y147 w420 h10 cfs , WFS (5151515151)|Spirit (5151515151) 
Gui, Add, CheckBox, x26 y197 w130 h30 forside, Opret og Print Forside 
Gui, Add, Button, x26 y257 w140 h40 submitBtn, Udfyld Detaljer Automatisk 
; Generated using SmartGUI Creator 4.0 
Gui, Show, x131 y91 h379 w479, New GUI Window 
Return 

submitBtn: 
Gui, Submit 

MsgBox, 4, Mawb: %mawb%, CFS: %cfs% 

Gui, Destroy 
Return 
GuiClose: 
ExitApp 

当我按一下按钮,在上面AHK脚本,什么也没发生。我怎么可以提交一个脚本AHK GUI,然后“形式”后,做一些有已提交?

在此先感谢!

+0

你的代码是给我的错误:http://i.imgur.com/h7bWiI9.png什么版本的AutoHotkey您使用的是? – vasili111 2014-09-30 14:38:16

回答

1

您的解决方案非常接近工作。您需要修改两件事情:

  • 当在Gui, Add行声明一个变量,你必须把一个v在它的前面。
  • Gui, Add, Button行上,您必须将g放在标签名称的前面。

下面是一个版本的脚本的这些变化:

#T:: 
Gui, Add, Text, x26 y27 w420 h30 , MAWB: (Udfyld MAWB nummer format: xxx-xxxxxxxx) 
Gui, Add, Edit, x26 y67 w420 h20 vmawb, MAWB Nummer 
Gui, Add, Text, x26 y107 w420 h30 , Vælg Handling Agent 
Gui, Add, DropDownList, x26 y147 w420 h10 vcfs , WFS (5151515151)|Spirit (5151515151) 
Gui, Add, CheckBox, x26 y197 w130 h30 vforside, Opret og Print Forside 
Gui, Add, Button, x26 y257 w140 h40 gsubmitBtn, Udfyld Detaljer Automatisk 
; Generated using SmartGUI Creator 4.0 
Gui, Show, x131 y91 h379 w479, New GUI Window 
Return 

submitBtn: 
Gui, Submit 

MsgBox, 4, Mawb: %mawb%, CFS: %cfs% 

Gui, Destroy 
Return 
GuiClose: 
ExitApp