请输入您要查询的百科知识:

 

词条 AutoIt
释义

  1. Features

  2. Usage

  3. Examples

     Hello world  Automating the Windows Calculator  Find average 

  4. History

  5. See also

  6. References

  7. External links

{{Infobox software
| name = AutoIt
| logo = Autoitlogo.png
| screenshot =
| caption =
| developer = Jonathan Bennett & AutoIt Team
| released = {{Release date and age|1999|01}}
| latest_release_version = 3.3.14.5
| latest_release_date = {{Release date and age|2018|03|16}}[1]
| latest preview version =
| latest preview date =
| programming language = C++
| operating_system = Microsoft Windows
| genre = GUI Scripting language Automation
| license = Freeware closed source
| website = {{URL | http://www.autoitscript.com/ }}
}}

AutoIt {{IPAc-en|ɔː|t|oʊ|_|ɪ|t}}[2] is a freeware automation language for Microsoft Windows. In its earliest release, the software was primarily intended to create automation scripts (sometimes called macros) for Microsoft Windows programs[3] 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 data type that can store several types of data, including arrays. While version 1 and 2 were compatible with Windows 95, 98, ME, NT4, 2000, XP, 2003, Vista, Windows 7, support for operating systems older than Windows 2000 was discontinued with the release of v3.3.0 in December 2008.[4] Currently AutoIt is also compatible with Windows 2008, Windows 8, Windows 2012, Windows 10, and the minimal requirement is Windows XP SP3.

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")[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.

Features

  • Scripting language with BASIC-like structure for Windows
  • Compiling into standalone executables
  • Add-on libraries and modules for specific apps
  • Supports TCP and UDP protocols
  • Supports component object model (COM)
  • Call functions in DLL files
  • Run console apps and access the standard streams
  • Include data files in the compiled file to be extracted when run
  • Create graphical user 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 movements
  • Manipulate windows and processes
  • Automate sending user input and keystrokes to apps, as well as to individual controls within an app
  • Unicode support from version 3.2.4.0
  • 64-bit code support from version 3.2.10.0
  • Supports regular expressions
  • Compatible with User Account Control
  • Object-oriented design through a library[6]

Usage

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 has can also be used in low-cost laboratory automation. Applications include instrument synchronisation, alarm monitoring and results gathering. Devices such as CNC routers and 3D-printers can also be controlled.[7]

Examples

Hello world

Make available a library of constant values.
  1. include
Displays "Hello, world!" in a messagebox.

MsgBox($MB_SYSTEMMODAL, "Title", "Hello, world!")

Automating the Windows Calculator

Make available a library of constant values.
  1. include
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]")

Find average

Find Average by JohnOne, modified by czardas
  1. include

_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

History

  • January 1999 - First AutoIt Version (1.0)
  • August 1999 - AutoIt v2 and AutoItX
  • September 1999 - First AutoIt version with Compiler
  • December 2002 - AutoIt v3 (Public Beta)
  • February 2004 - AutoIt v3 (Stable)
  • September 2006 - Auto3Lib started
  • November 2007 - AutoIt v3.2.10.0 released, Auto3Lib incorporated into AutoIt v3
  • May 2008 - AutoIt v3.2.12.0 released, incorporating added GUI functionality
  • December 2008 - AutoIt (and AutoItX) v3.3.0.0 released
  • December 2009 - AutoIt v3.3.2.0 released
  • January 2010 - AutoIt v3.3.4.0 released
  • March 2010 - AutoIt v3.3.6.0 released
  • April 2010 - AutoIt v3.3.6.1 released
  • December 2011 - AutoIt v3.3.8.0 released
  • January 2012 - AutoIt v3.3.8.1 released
  • December 2013 - AutoIt v3.3.10.0 released
  • June 2014 - AutoIt v3.3.12.0 released
  • July 2015 - AutoIt v3.3.14.0 and v3.3.14.1 released
  • September 2015 - AutoIt v3.3.14.2 released[8]
  • February 2018 - AutoIt v3.3.14.3 released [9]

The developers of AutoIt originally released the source code under the GNU General Public License (GPL),[10][11] but the practice was discontinued beginning with version 3.2.0 in August 2006.{{fact|date=October 2018}} Following the terms of the GPL, some of the code from version 3.1 was used to create a fork by the AutoHotkey project,[12] where the community is continuing to develop and release the code under the GPL.

See also

  • AutoHotkey
  • Macro Express
  • Automator (for Macintosh)
  • Keyboard Maestro (for Macintosh)
  • KiXtart
  • iMacros
  • thinBasic
  • Visual Basic
  • Winbatch
  • Expect

References

1. ^{{cite web|url=http://www.autoitscript.com/site/autoit/downloads/|title=AutoIt Downloads}}
2. ^Reply by Jon (AutoIt creator) to a forum topic discussing correct pronunciation{{dead link|date=October 2016 |bot=InternetArchiveBot |fix-attempted=yes }}
3. ^{{cite book | last = Kaplan | first = Steve | title = Citrix Metaframe Access Suite for Windows Server 2003 | publisher = McGraw-Hill | location = New York | year = 2003 | isbn = 0-07-219566-5 }}
4. ^{{cite web|author=Jon |url=http://www.autoitscript.com/forum/index.php?showtopic=86590&st=0&entry620851 |title=AutoIt v3.3.0.0 Released - Announcements and Site News - AutoIt Forums |publisher=Autoitscript.com |date=2008-12-24 |accessdate=2014-01-23}}
5. ^https://www.autoitscript.com/wiki/User_Defined_Functions
6. ^AutoitObject. a library to use object oriented design in autoit {{webarchive |url=https://web.archive.org/web/20100226105014/http://autoitobject.origo.ethz.ch/ |date=February 26, 2010 }}
7. ^{{cite book|title=Practical Laboratory Automation: Made Easy with AutoIt|last=Carvalho|first=Matheus C.|publisher=Wiley V|year=March 2016|isbn=978-3-527-34158-0|pages=5—7|id=Topics Covered in this Book}}
8. ^{{Cite web|url=http://www.autoitscript.com/autoit3/docs/history.htm|title=AutoIt History|website=www.autoitscript.com|access-date=2016-04-19}}
9. ^[https://www.autoitscript.com/site/autoit-news/autoit-v3-3-14-3-released/ AutoIt v3.3.14.3 Released Feb 2, 2018]
10. ^{{cite web| url=https://www.autoitscript.com/forum/topic/7204-licensing-opinions/| title=Licensing Opinions| date=2005-05-02| website=AutoIt| quote=The GPL license was chosen as it is generally accepted as the most restrictive.| accessdate=2018-10-05}}
11. ^{{cite web| archive-url=https://web.archive.org/web/20050104172743/https://www.autoitscript.com/autoit3/docs/license.htm| archive-date=2005-01-04| date=2014-03-25| url=https://www.autoitscript.com/autoit3/docs/license.htm| title=License| quote=AutoIt is copyrighted software distributed under the terms of the GNU General Public License (hereinafter the "GPL").| accessdate=2018-10-05}}
12. ^Chris Mallet (author of AutoHotkey)'s post

External links

  • {{Official website}}
{{BASIC}}{{DEFAULTSORT:Autoit}}

3 : Scripting languages|Automation software|Proprietary software

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/29 21:22:54