My aim here is to kind of give others a fast track to being able to make their own simple GUIs. I will take this Basic GUI Script and explain simple as I can whats going on. Hopefully with this post, a little tinker time, and SmartGUI tool found here: www.autohotkey.com/docs/SmartGUI/ That you will be a master of the AHK GUI in no time.
Gui,2:+AlwaysOnTop Gui,2:Add,Edit,x0 y0 w200 h20 vS Gui,2:Add,button, default gA1, Ok Gui,2:Show,,User Input Return A1: Gui,2:submit,nohide Msgbox, 262208,Title Of Msgbox,%s% Gui,2:destroy return 2GuiClose: ExitApp
;Hope This Helps, most every line is explained. Gui,2:+AlwaysOnTop ;Whats Gui,2:? the 'Gui,#:' command I believe that it lets you Target specific Gui pieces for like 'Gui,2:destroy' command not needed with a simple Gui. Have I personally have not done anything with it yet at the time of writing this, just thought I would say something about it case people wondered what the... ;AlwaysOnTop is one of many +Options you may use found in the GUI Help. Gui,2:Add,Edit,x0 y0 w200 h20 vS ;Above line kinda explained> Gui,#:add,edit,loc on screen xy, size object wh, v* is the variable where users input is stored. Gui,2:Add,button, default gA1, Ok ;whats gA1? 'g' = goto so 'A1' is the function label, don't forget a 'return' on your block or it keeps going to the next line. ;Whats the A1? just a label can be what ever you want, in this case it stands for Action1 to me. ;you can do default or Hide default, enter performs default button action. Gui,2:Show,,User Input ;Gui,#:Show, Options, Title> the options for show can be found on GUI Help page. Return A1: Gui,2:submit,nohide ;This line submits the users input, can hide the input window or not with nohide. Msgbox, 262208,Title Of Msgbox,%s% ;what the? Msgbox = makes msg box, 262208 is the added value of the selected Options found in msgbox help, Title, then text to be displayed in this case variable S. Gui,2:destroy ;Kills the Targeted Gui. return 2GuiClose: ;closes the Gui of target #GuiClose: Remember # stuff does not even need to be there on a simple Gui so for instance Gui,2:+AlwaysOnTop becomes Gui,+AlwaysOnTop and 2GuiClose: becomes GuiClose: ExitApp ;Exits App