AutoIt | |
Designer: | Jonathan Bennett |
Developer: | AutoIt Consulting Ltd. |
Paradigm: | imperative, functional, procedural, reflective |
Latest Release Version: | 3.3.16.1 |
Latest Release Date: | [1] |
Latest Preview Version: | 3.3.16.1 RC2 |
Latest Preview Date: | [2] |
Influenced By: | BASIC |
Platform: | IA-32 and x64 |
Operating System: | Windows XP SP3 and later Windows Server 2003 and later |
License: | Freeware |
File Extensions: | .au3 |
AutoIt [3] is a freeware programming language for Microsoft Windows. In its earliest release, it was primarily intended to create automation scripts (sometimes called macros) for Microsoft Windows programs[4] but has since grown to include enhancements in both programming language design and overall functionality.
The scripting language in AutoIt 1 and 2 was statement-driven and designed primarily for simulating user interaction. From version 3 onward, 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 data type that can store several types of data, including arrays.
An AutoIt automation script can be converted into a compressed, stand-alone executable which can be run on computers even if they do not have the AutoIt interpreter installed. A wide range of function libraries (known as UDFs, or "User Defined Functions")[5] are also included as standard or are available from the website to add specialized functionality. AutoIt is also distributed with an IDE 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.
AutoIt1 and AutoIt2 were closed-source projects, and had a very different syntax than AutoIt3, whose syntax is more like VBScript and BASIC.[6]
AutoIt3 was initially free and open-source, licensed under the terms of the GNU General Public License,[7] [8] with its initial public release 3.0.100 in February 2004,[9] and had open-source releases in March 2004 and August 2004. Version 3.0.102, released in August 2004, was initially open-source, but by January 2005 was distributed as closed-source.[10] Subsequent releases, starting from the February 2005 release of version 3.1.0, were all closed-source. Version 3.1.0 was also the first release with support for GUI scripts.
The free and open-source AutoHotkey project derived 29 of its functions from the AutoIt 3.1 source code.[11] The AutoHotkey syntax is quite different from AutoIt3 syntax, and rather resembles AutoIt2 syntax.
AutoIt is typically used to produce utility software for Microsoft Windows and to automate routine tasks, such as systems management, monitoring, maintenance, or software installation. It is also used to simulate user interaction, whereby an application is "driven" (via automated form entry, keypresses, mouse clicks, and so on) to do things by an AutoIt script.
AutoIt can also be used in low-cost laboratory automation. Applications include instrument synchronization, alarm monitoring and results gathering. Devices such as CNC routers and 3D-printers can also be controlled.[12]
_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 ;
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 ;