CHAPTER 1
GUI (Graphical User Interface)
Introduction
This is just the basics of AutoIt. By the end of this tutorial you will be able to create your own little simple bot that can spam custom timed key strokes.Section 1
To download AutoIt just visit their website at [Only registered and activated users can see links. Click Here To Register...] and download the latest version (version 3.3.0.0 as of today). Download, run it, install it... you know what to do.
Create a new folderSection 2
Create a new folder and call it "Scripts".
Create a .au3 file
Alright, now that you have AutoIt installed you should be able to create a new .au3(autoit script) file. Simply right click any where in the folder, then hit the new button, and then click AutoIt v3 Script.
[Only registered and activated users can see links. Click Here To Register...]
Name the file
Now name the file what ever you want, for example I named my "epoxgonewild".
Open the file
Open the autoit v3 script file, right click and press Edit.
Adding proper headerSection 3
Now that you have the .au3 file open lets begin to write shit in it. Before we do anything you should always add the proper header to your code. I usually use something pretty/fancy looking like this.
CS stands for comment start and indicates the beginning of a comment. You don't necessarily have to have all those dashes after it, just makes it look nice.Code:#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Forsaken #ce ----------------------------------------------------------------------------
CE if you haven't figured it out by now(shame on you), stands for comment end and is the last line of the comment (you can have text after it but only on that line).
Importing the GUI features
If you want to use GUI (graphical user interface) you must add this line so autoit recognizes and can import the GUI features you use.
The GUISetState statement basically tells the program once run that it should show the GUI, without adding this the program will not display GUI. Be sure to always have this piece the last part of your GUI section because the program is read from top to bottom once run.Code:#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Forsaken #ce ---------------------------------------------------------------------------- #include <GUIConstantsEx.au3> GUISetState(@SW_SHOW)
Making the frame
Pew pew, first cool step. In AutoIt all you have to do is add GUICreate and define the window title and dimensions. Easy enough, right?
("Forsaken's Bot", 335, 100)Code:#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Forsaken #ce ---------------------------------------------------------------------------- #include <GUIConstantsEx.au3> GUICreate("Forsaken's Bot", 335, 100) GUISetState(@SW_SHOW)
("x", y, z)
x = The windows title, it will appear in the window bar where you close and minimize the program.
y = The windows width, determines how wide/horizontal the program is.
z = The windows height, determines how high/vertical the program is.
If all was done correctly, once run your frame should look like this.
[Only registered and activated users can see links. Click Here To Register...]
###NOTE: If you went on ahead and saved/ran the program it should have opened just for a second and then closed. That is fine, we will fix that later once we add some actual code.###
Add the code below to end of the script if you do want to preview it.Code:While 1 sleep(1) WEnd
Adding a labelSection 4
Label, other wise known as text. For that we use GUICtrlCreateLabel.
("text", 8, 10)Code:#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Forsaken #ce ---------------------------------------------------------------------------- #include <GUIConstantsEx.au3> GUICreate("Forsaken's Bot", 335, 100) GUICtrlCreateLabel("text", 8, 10) GUISetState(@SW_SHOW)
("x", y, z)
x = What ever is put inside of the quotation marks will be printed in the frame you made.
y = This is the horizontal position of where the text will be placed, I am not sure but I believe it is measure in pixels.
z = This is the vertical position of where the text will be placed.
You should have something that looks like this now.
[Only registered and activated users can see links. Click Here To Register...]
###NOTE: If you went on ahead and saved/ran the program it should have opened just for a second and then closed. That is fine, we will fix that later once we add some actual code.###
Add the code below to end of the script if you do want to preview it.Code:While 1 sleep(1) WEnd
Adding Input box
Input are used to submit data (such as text, numbers, and symbols) from the user and store them. Using GUICtrlCreateLabel.
$key1 This is a variable/string. This stores what ever comes after it, which in this case would be what ever the user inputs into the input box we made. It allows you to reference back to it and use it. You can name this what ever you want (ex. $input $lol $epoxisgay $wtfsfsdf)Code:#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Forsaken #ce ---------------------------------------------------------------------------- #include <GUIConstantsEx.au3> GUICreate("Forsaken's Bot", 335, 100) GUICtrlCreateLabel("text", 8, 10) $key1 = GUICtrlCreateInput("", 35, 8, 120) GUISetState(@SW_SHOW)
("", 35, 8, 120)
("x", y, z, s)
x= Leave this blank, unless you want default text there. It can be edited by user.
y = Horizontal position.
z = Vertical position.
s = Width of the input box.
If all is done correctly, it should look like this now.
[Only registered and activated users can see links. Click Here To Register...]
###NOTE: If you went on ahead and saved/ran the program it should have opened just for a second and then closed. That is fine, we will fix that later once we add some actual code.###
Add the code below to end of the script if you do want to preview it.Code:While 1 sleep(1) WEnd
Duplicating codeSection 5
Since this a very long tutorial already (we are only half way) I am just going to skip explaining step by step how to add more labels and input boxes because it's exactly the same method listed in section 3. All you have to do is change the positions and variable/string names.
I just added 1 more label and more input with the variable/string $time1.Code:#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Forsaken #ce ---------------------------------------------------------------------------- #include <GUIConstantsEx.au3> GUICreate("Forsaken's Bot", 335, 100) GUICtrlCreateLabel("Text", 8, 10) $key1 = GUICtrlCreateInput("", 35, 8, 120) GUICtrlCreateLabel("Text", 8, 44) $time1 = GUICtrlCreateInput("", 35, 40, 120) GUISetState(@SW_SHOW)
Re-labeling
Okay, so this is almost the end of the GUI portion we just need to add start button. But first lets rename those labels to something that the user will understand.
[Only registered and activated users can see links. Click Here To Register...]Code:#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Forsaken #ce ---------------------------------------------------------------------------- #include <GUIConstantsEx.au3> GUICreate("Forsaken's Bot", 335, 100) GUICtrlCreateLabel("Key", 8, 10) $key1 = GUICtrlCreateInput("", 35, 8, 120) GUICtrlCreateLabel("Time", 8, 44) $time1 = GUICtrlCreateInput("", 35, 40, 120) GUISetState(@SW_SHOW)
###NOTE: If you went on ahead and saved/ran the program it should have opened just for a second and then closed. That is fine, we will fix that later once we add some actual code.###
Add the code below to end of the script if you do want to preview it.Code:While 1 sleep(1) WEnd
Adding a button
The button is what will start the botting. We will be using the GUICtrlCreateButton function to create the button.
$startbutton is the variable we assigned to the button so we can refrence back to it once we need it.Code:#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Forsaken #ce ---------------------------------------------------------------------------- #include <GUIConstantsEx.au3> GUICreate("Forsaken's Bot", 335, 100) GUICtrlCreateLabel("Key", 8, 10) $key1 = GUICtrlCreateInput("", 35, 8, 120) GUICtrlCreateLabel("Time", 8, 44) $time1 = GUICtrlCreateInput("", 35, 40, 120) $startbutton = GUICtrlCreateButton("Start", 190, 8, 60) GUISetState(@SW_SHOW)
("Start", 190, 8, 60)
("x", y, z, s)
x= Button label.
y = Horizontal position.
z = Vertical position.
s = Width of the button.
[Only registered and activated users can see links. Click Here To Register...]
###NOTE: If you went on ahead and saved/ran the program it should have opened just for a second and then closed. That is fine, we will fix that later once we add some actual code.###
Add the code below to end of the script if you do want to preview it.Code:While 1 sleep(1) WEnd