From Bauman National Library
This page was last modified on 8 June 2016, at 21:53.
Developer Jonathan Bennett & AutoIt Team
First appeared Template:Release date and age
License Freeware closed source

AutoIt Reply by Jon (AutoIt creator) to a forum topic discussing correct pronunciation is a freeware automation programming language for Microsoft Windows. In its earliest release, the software was primarily intended to create automation scripts (sometimes called Macro (computer science)) for Microsoft Windows programs but has since grown to include enhancements in both programming language design and overall functionality.

While the scripting language in AutoIt 1 and 2 was statement-driven, designed primarily for simulating user interaction, from version 3 onwards the AutoIt syntax is similar to that found in the BASIC family of languages. In this form, AutoIt is a general-purpose, third-generation programming language with a classical data model and a variant type that can store several types of data, including arrays. While version 1 and 2 were compatible with Windows Windows 95, Windows 98, Windows ME, Windows NT4, Windows 2000, Windows XP, Windows 2003, Windows Vista and Windows 7, support for operating systems older than Windows 2000 was discontinued with the release of v3.3.0 in December 2008).

An AutoIt automation script can be converted into a compressed, stand-alone executable which can be run on computers that do not have the AutoIt interpreter installed. A wide range of function libraries (known as UDFs, or "User Defined Functions") are also included as standard or are available from the website to add specialized functionality. AutoIt is also distributed with an Integrated development environment based on the free SciTE editor. The compiler and help text are fully integrated and provide a de facto standard environment for developers using AutoIt.

History of developing

Introduction and AutoIt History AutoIt started in late 1998 as a C-compiled program used to automate keystrokes during software installations. In January 1999, the AutoIt team released AutoIt v1, which included the Send, Run, RunWait, WinWait, WinWaitClose, WinWaitActive, WinHide, WinActivate, WinClose, WinRestore, Sleep and SetKeyDelay functions. AutoIt v2 was released in August that same year and included the first version of AutoItX, which offered DLL/COM control. Over the next two years, massive updates to AutoIt v2 added many new functions to the language. In May 2001, the AutoIt source code was completely rewritten in C++ and development stalled until 2003, when the first beta version of AutoIt v3 was released. Over 100 beta versions later, the AutoIt developers released AutoIt v3 in February of 2004. February of 2005 marked the release of AutoIt v3.1.0, which added the capability of graphical user interface (GUI) creation. This version was the most notable release because it brought AutoIt to the forefront of the scripting world and made it a rival to Visual Basic Scripting, batch files, and other popular scripting languages. AutoIt is free to use and has a strong and helpful community base.

The main advantages of the language

  • Scripting language with BASIC-like structure for Windows Desktop Environment.
  • Add-on libraries and modules for specific applications.
  • On-line support forum for AutoIt users and developers.
  • Supports Transmission Control Protocol and User Datagram Protocol protocols.
  • Supports COM (component object modelling) objects.
  • Call functions in Win32 DLLs.
  • Run console applications and access the standard streams.
  • Include files in the compiled file to be extracted when run.
  • Create Graphical User Interface interfaces, including message and input boxes.
  • Play sounds, pause, resume, stop, seek, get the current position of the sound and get the length of the sound.
  • Simulate Mouse (computing) movements.
  • Manipulate windows and processes.
  • Automate sending user input and keystrokes to applications, as well as to individual controls within an application.
  • Scripts can be compiled into standalone executables.
  • Unicode support from version
  • 64-bit code support from version
  • Supports regular expressions.
  • Works with Windows Vista's User Account Control.
  • Object oriented design through a library

The extension scripts and run

Script files usually have the extension *.au3 that corresponds to the name of interpretator by which they will run, namely, AutoIt3.exe. Assume that we have created the script: script.au3, then to run it you must execute the following command:

alexey# AutoIt3.exe script.au3

The syntax of the language

The first program

MsgBox(0, "The first program", "Hello, world!")


Variables are created using the keyword Dim, Local, Global.

Dim $var, $message, $error = "404 Not found"


This language has a large number of different conditional structures: If ... Then ... Else ... EndIf:

 $var = 10    
 If($var > 0) Then  
   MsgBox(0,""," > 0 ")  
 ElseIf($var < 0 ) Then                
   MsgBox(0,""," < 0 ")  
   MsgBox(0,""," == 0")  

The construction of "Select ... Case". Used to select from a large number of options. If the condition is true, execute all the following commands until the next Case or EndSelect expression. If you find a fair multiple Case expressions, only the first of them. Example:

 $var = 30 
   Case $var > 1 AND $var <= 10 
     MsgBox(0, "", "Variable is between 1 and 10(inclusive)") 
   Case $var > 10 AND var <= 20 
     MsgBox(0, "", "the Variable is between 10 and 20(inclusive)") 
   Case $var > 20 AND $var <= 30 
     MsgBox(0, "", "Variable is between 20 and 30(inclusive)") 
   Case $var > 30 AND $var <= 40 
     MsgBox(0, "", "the Variable is between 30 and 40(inclusive)") 
   Case Else 
     MsgBox(0, "", "Variable greater than 40") 

The construction of "Switch ... Case":

 Switch @HOUR                ; @HOUR macro which gives us the value of the hour at the moment
   Case 6 To 11 
     $msg = "Good morning!" 
   Case 12 To 17 
     $msg = "Good afternoon!" 
   Case 18 To 21 
     $msg = "Good evening" 
   Case Else 
     $msg = "Time to sleep!" 
 MsgBox(0, "", "Now" &amp; @HOUR &amp; " hours. "&amp; $msg)


In AutoIt there are three kinds of looping constructs:

  1. loops with a precondition
  2. loops with postcondition
  3. loops with known number of repetitions.

The Loop "While ... WEnd". If the condition is true, commands up to the WEnd will be executed until the while expression will cease to be faithful.

 $i = 0  
 While $i <= 5  
   MsgBox(0, "","Value $i : " &amp; $i)  
   $i = $i + 1  

The Loop "Do ... Until", "Do ... Until". Cyclic execution of commands as long as a specified condition becomes true:

 $i = 0  
   MsgBox(0, "", "Value $i : " &amp; $i)  
   $i = $i + 1  
 Until $i = 5

The expression "For ... Next" can be nested into each other. The loop ends when the variable value exceeds the specified threshold, Stop:

 For $i = 5 to 1 Step -1 
   MsgBox(0, "Countdown!", $i) 
 MsgBox(0,"Start", "Go!")

Definition of user-defined functions

Custom functions are created using the design:

 Func name-function() 
     ; Function body 

An example of declaring and calling functions:

 Func ShowMessage($param_title, $param_text, $param_type = 0)  
   MsgBox($param_type, $param_title, $param_text)  
 ShowMessage("Welcome","Hi! How are you?")

Using AutoIt in practice

In this example realizes windows clock:

  #include <GUIConstantsEx.au3> ; Include file into script
  ;- Window ------------------------------
  GUICreate("Clock", 155, 111, 192, 114)
  ;- Clock -------------------------------------------------------------
  AdlibRegister("MainScript", 400) ; Update hours
  $Clock = GUICtrlCreateLabel(@HOUR &amp; ":" &amp; @MIN &amp; ":" &amp; @SEC, 50, 20)
  ;- Settings ---------------------
  While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
          Case $GUI_EVENT_CLOSE
  ;- Sinchronize with computer -----------------------------
  Func MainScript()
      GUICtrlSetData($Clock, @HOUR &amp; ":" &amp; @MIN &amp; ":" &amp; @SEC)

Community AutoIt

Official English forum is located at the address There users can share their scripts and functions, get support, report bugs, contribute ideas and suggestions, communicate with the developers.

There is also a site of the Russian-speaking community, which is located at