0
votes

I am fairly new to the AutoHotKey program. I am trying to create a fairly simple "app", which lets me enter some details, and then return them to me in a msgBox. This is what I do:

#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

When I click on the button, in the above AHK script, nothing happens.. How can I submit a script in AHK gui, and then do something after the "form" has been submitted?

Thanks in advance!

1
Your code is giving me error: i.imgur.com/h7bWiI9.png What version of AutoHotkey are you using?vasili111

1 Answers

1
votes

Your solution is very close to working. You need to modify 2 things:

  • When declaring a variable on a Gui, Add line, you must put av in front of it.
  • On a Gui, Add, Button line you must put g in front of the label name.

Below is a version of your script with those changes:

#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