Jump to content
Tuts 4 You

Learn Autohotkey!


Guest bGraHam-AhK

Recommended Posts

Guest bGraHam-AhK

Hi guys, Today i will be writing up 2 Tutorials.

The First ( This Thread ) Is about GUI's ( Graphical User Interface's )

The Second ( Not Made Yet ) Is about advanced GUI's

So lets start off:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

What We Need:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SmartGUI Creator

and if you havent already got it,

Autohotkey

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The Code:

Gui, Add, Text, x6 y10 w130 h60 , This is your First GUI!`nWhen You click the button`nIt will bring up a`nInputBox
Gui, Add, Button, x16 y90 w110 h30 , Click Me
Gui, Show, x131 y91 h136 w146, New GUI Window
ReturnButtonClickMe:
InputBox, UserInput, Phone Number, Please enter a phone number., , 640, 480
if ErrorLevel
MsgBox, CANCEL was pressed.
else
MsgBox, You entered "%UserInput%"
ReturnGuiClose:
ExitApp

The Breakdown:

Now before i begin the Breakdown, i must explain sonething.

Notice how after the first 3 lines of code, it has return?

Well, anything that happens BEFORE the first return is typed, is called the Auto Execute Section,

meaning, if you wanted to write out some preset variables ( mostly something that barely ever changes )

you would put it before the first 'Return'

Now you may notice i havent used 'Return' before, that is because Return is also used

to keep whatever is showing, THERE!

So just for the sake of this, try writing out the code WITHOUT the first Return, it will do one of the following.

Flash a screen infront of you and dissapear. or do nothing at all.

So If you put GUI code in the Auto Execute section, and put a return after it it will stay there until you exit the program,

But, now this is quite annoying, but when you use the 'Return' command inside of a buttons area: e.g.:

ButtonClickMe:;Im a button, anything you write after a ';' is comment
MsgBox, Below me will be a 'Return'
Return

The return takes you back to the Auto Execute Section, therefore keeping you GUI's in their places!

So basically, when you use Return in the AES ( Auto Execute Section ) it keeps whatever is above it working.

And when it is used inside a buttons or commands area, it Takes the script back to the AES.

Now im going to let you explain to me what the code is doing, and ill reply on whether you right or wrong.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...