AutoIt facts for kids
![]() |
|
![]() |
|
Paradigm | imperative, functional, procedural, reflective |
---|---|
Designed by | Jonathan Bennett |
Developer | AutoIt Consulting Ltd. |
First appeared | January 1999 |
Stable release |
3.3.16.1 / September 19, 2022
|
Preview release |
3.3.16.1 RC2 / June 9, 2022
|
Platform | IA-32 and x64 |
OS | Windows XP SP3 and later Windows Server 2003 and later |
License | Freeware |
Filename extensions | .au3 |
Influenced by | |
BASIC |
AutoIt is a special computer language that helps you make programs for computers that use Microsoft Windows. It's free to use!
At first, it was made to create "automation scripts" or "macros". These are like step-by-step instructions that tell your computer to do tasks automatically. But now, AutoIt can do much more!
Older versions of AutoIt (like AutoIt 1 and 2) were mostly about pretending a user was typing or clicking. But from version 3, AutoIt started to look more like other computer languages, especially BASIC. It became a powerful language that can handle many different kinds of information, like lists of numbers or words.
You can turn your AutoIt script into a small program that works on its own. This means you can share your program with friends, and they don't need to install AutoIt to run it! It also comes with many helpful tools called "User Defined Functions" (UDFs). These UDFs add special abilities to your scripts. AutoIt also includes a special program called SciTE that helps you write and test your code.
Contents
How AutoIt Started and Grew
1999 | January: First AutoIt Version (1.0) |
---|---|
August: AutoIt v2 and AutoItX | |
September: First AutoIt version with Compiler | |
2000 | |
2001 | |
2002 | December: AutoIt v3 (Public Beta) |
2003 | |
2004 | February: AutoIt v3 (Stable) |
2005 | |
2006 | September: Auto3Lib started |
2007 | November: AutoIt v3.2.10.0 released, Auto3Lib incorporated into AutoIt v3 |
2008 | May: AutoIt v3.2.12.0 released, incorporating added GUI functionality |
December: AutoIt (and AutoItX) v3.3.0.0 released | |
2009 | December: AutoIt v3.3.2.0 released |
2010 | January: AutoIt v3.3.4.0 released |
March: AutoIt v3.3.6.0 released | |
April: AutoIt v3.3.6.1 released | |
2011 | December: AutoIt v3.3.8.0 released |
2012 | January: AutoIt v3.3.8.1 released |
2013 | December: AutoIt v3.3.10.0 released |
2014 | June: AutoIt v3.3.12.0 released |
2015 | July: AutoIt v3.3.14.0 and v3.3.14.1 released |
September: AutoIt v3.3.14.2 released | |
2016 | |
2017 | |
2018 | February: AutoIt v3.3.14.3 released |
March: AutoIt v3.3.14.5 released | |
2019 | |
2020 | |
2021 | |
2022 | March: AutoIt v3.3.16.0 released |
September: AutoIt v3.3.16.1 released |
The first versions of AutoIt, called AutoIt1 and AutoIt2, were not open for everyone to see how they worked. Their way of writing code was also very different from AutoIt3. AutoIt3's code looks more like VBScript and BASIC.
AutoIt3 started as a free and open-source project. This means anyone could see and change its code. The first public version, 3.0.100, came out in February 2004. More open-source versions followed in March and August 2004.
However, by January 2005, version 3.0.102, which was first open-source, became closed-source. All new versions after that, starting with version 3.1.0 in February 2005, were also closed-source. Version 3.1.0 was also the first to let you create graphical user interfaces (GUIs), which are the windows and buttons you see on your screen.
Other Similar Projects
There is another free and open-source project called AutoHotkey. It used some of the code from AutoIt 3.1. But AutoHotkey's way of writing code is quite different from AutoIt3. It actually looks more like the older AutoIt2.
What AutoIt Can Do
AutoIt is often used to make helpful programs for Microsoft Windows. It's great for making routine tasks happen automatically. For example, it can help with managing computer systems, checking on things, doing maintenance, or installing software.
It can also pretend to be a user. This means an AutoIt script can "drive" an application by filling in forms, pressing keys, or clicking the mouse.
AutoIt can even be used in labs to control equipment. It can help with things like making sure instruments work together, watching for alarms, and collecting results. You can also use it to control machines like CNC routers and 3D-printers.
Here are some cool things AutoIt can do:
- It works with 64-bit computer code since version 3.2.10.0.
- You can add extra tools and parts for specific apps.
- It can send keyboard presses and mouse clicks to apps, and even to specific buttons or boxes inside an app.
- It can use functions from special files called DLL files.
- It works well with User Account Control on Windows.
- You can turn your scripts into programs that run by themselves.
- It can create graphical user interfaces (GUIs), like message boxes and input boxes.
- You can put data files inside your finished program, and they will be taken out when the program runs.
- It can control windows and programs running on your computer.
- You can use an object-oriented style with a special library.
- It can play sounds, pause, stop, and even find specific parts of a sound.
- It can run programs that use a text-based screen and get information from them.
- It's a scripting language for Windows with a structure similar to BASIC.
- It can move the mouse around on your screen.
- It supports the Component Object Model (COM).
- It understands regular expressions, which are patterns for finding text.
- It supports TCP and UDP for network communication.
- It supports Unicode from version 3.2.4.0, which means it can handle many different languages and symbols.
Simple AutoIt Examples
These examples show how AutoIt code looks and what it can do.
Hello World Program
This is a classic first program that just shows a message.
; Make available a library of constant values.
#include <MsgBoxConstants.au3>
; Displays "Hello, world!" in a message box.
MsgBox($MB_SYSTEMMODAL, "Title", "Hello, world!")
Automating the Windows Calculator
This script shows how AutoIt can open the Calculator and do some math automatically.
; Make available a library of constant values.
#include <MsgBoxConstants.au3>
; Display a message box with a timeout of 6 seconds.
MsgBox($MB_OK, "Attention", "Avoid touching the keyboard or mouse during automation.", 6)
; Run the Windows Calculator.
Run("calc.exe")
; Wait for the calculator to become active with a timeout of 10 seconds.
WinWaitActive("[CLASS:CalcFrame]", "", 10)
; If the calculator did not appear after 10 seconds then exit the script.
If WinExists("[CLASS:CalcFrame]") = 0 Then Exit
; Automatically type the current year into the calculator.
Send(@YEAR)
; Let's slow the script down a bit so we can see what's going on.
Sleep(600)
; Automatically type in 'divide by 4', and then sleep 600 ms.
Send("/4")
Sleep(600)
; Hit the return key to display the result, and sleep 600 ms.
Send("{ENTER}")
Sleep(600)
; Copy the result to the clipboard using the Windows shortcut Ctrl+C.
Send("^c")
; Declare, and assign the contents of the clipboard to, a variable.
Local $fResult = ClipGet()
; Check to see if the variable contains a decimal point or not.
If StringInStr($fResult, ".") Then
; Display a message box with a timeout of 5 seconds.
MsgBox($MB_OK, "Leap Year", @YEAR & " is not a leap year.", 5)
Else
; This message will only display if the current year is a leap year.
MsgBox($MB_OK, "Leap Year", @YEAR & " is a leap year.", 5)
EndIf
; Close the Windows calculator - always tidy up afterwards.
WinClose("[CLASS:CalcFrame]")
Finding the Average of Numbers
This example shows how to ask a user for numbers and then calculate their average.
; Find Average by JohnOne, modified by czardas
#include <MsgBoxConstants.au3>
_Example() ; Run the example.
Func _Example()
; Display an input box and ask the user to enter some numbers separated by commas.
Local $sInput = InputBox("Find Average", "Enter some numbers separated by commas: 1,2,42,100,3")
; If an error occurred then exit the script.
If @error Then Exit
; Populate an array with the user's input.
Local $aSplit = StringSplit($sInput, ",")
; Pass the array to the function _Find_Average() and then check for errors.
Local $fAverage = _Find_Average($aSplit)
If @error Then Exit
; Display the result in a message box.
MsgBox($MB_OK, "Find Average", "Result: " & $fAverage)
EndFunc ;==>_Example
Func _Find_Average($aArray)
; If the input is not of the correct type (an array), then return an error along with the details.
If Not IsArray($aArray) Then Return SetError(1, 0, VarGetType($aArray))
; More detailed checks are possible, but for brevity just one is performed here.
; Declare a variable to store the sum of the numbers.
Local $iArraySum = 0
; Loop through the array.
For $i = 1 To $aArray[0]
; Increment the sum by the number in each array element.
$iArraySum += Number($aArray[$i])
Next
; Return the average rounded to 2 decimal places.
Return Round($iArraySum / $aArray[0], 2)
EndFunc ;==>_Find_Average
See also
In Spanish: AutoIt para niños
- AutoHotkey
- Automator (for Macintosh)
- Expect
- iMacros
- Keyboard Maestro (for Macintosh)
- KiXtart
- Macro Express
- Winbatch