:: SmartGUI Creator ::
- Create Graphical
User Interfaces (GUIs) for AutoHotkey Scripts easily -
- Rajat -
Basically there is no installation required. Just extract 'SmartGUI.Exe' and 'Manual.Html' from the compressed 'smartgui.zip' file to any folder and run 'SmartGui.Exe'.
On its first run it'll generate a file named 'SmartGUI.Ini' that contains options and your preferences which are loaded in the next session.
For Uninstallation, just remove
the three files mentioned above and that's it.
(For more help on GUI features, open AutoHotkey help file, select Index Tab and type 'GUI')
Set GUI Count
Goal: Present a custom GUI to ask user his Name and Year of birth, and do basic processing.
1. Use SmartGUI to create a basic layout and save the script, something like this:
2. Add variable declarations to both edit fields (the letter 'v' followed by variable name). Like this:
3. Now assign functions to the 'Ok' and 'Cancel' buttons:
Ok should do further processing.
Cancel should do unquestioned exit.
A button's default section name (unless assigned otherwise) is the word 'Button' followed by its label.
Now, we can assign the same function to ButtonCancel as we've done to GuiClose, ie. unquestioned exit.
This is how the ButtonCancel section should look like:
4. Now we've to assign further processing function to 'Ok' button.
Lets say we want to calculate the user's age from the available data.
The first step to get data from a GUI is to make it submit it. The command for it is:
Note: 'Gui, Submit' is required only if you need to get data from edit fields, checkboxes etc.
So this is how the ButtonOk function should look like:
5. So finally our complete script should look like this:
Remember that in a control's section you can include just about anything, like run a program, open/close a window or send key presses.
Note: In both the sections (ButtonOk and ButtonCancel) there's no 'Return' command at the end, this is because both scripts exit at the end (ExitApp). Had this not been the case, a 'Return' would be required.
1. This will run notepad on the press of a button:
2. This will show your windows version:
Now go ahead and explore.
| Tips &