Home |
Last modified: 23-02-2024 |
AutoIt is a freeware alternative to applications like AutoHotKey to automate tasks through hotkeys/hotstrings and drive GUI applications. It used to be open-source — AutoHotKey was forked from AutoIt around 2005 —, but was closed-source later after a family feud. AHK is updated more frequently than AutoIt.
AutoIt is a procedural language and its syntax looks like BASIC, while AHK is a mix between C and Pascal. Although it has nowhere near the breadth of eg. Python, AutoIt could be good enough and used as an alternative to (Power|Pure|Free)Basic to write CLI/GUI apps.
In addition to native features, AutoIt is enhanced through User Defined Functions (UDFs), which are themselves coded in AutoIt and thus also have the .au3 extension. Some of them are included in the AutoIt installer, while others must be downloaded and installed manually — preferably in the User Include Folder as set through Tools > SciTE Config/CTRL+1. As AutoIt ships with a modified version of SciTE, it's not a good idea to manually upgrade it. If you still want to run a more recent version, check the thread.
Since AutoIt is primarily meant to automate the use of GUI apps, one of the important UDFs is IUIAutomation, which is the AutoIt implementation of Microsoft's UI Automation; It provides more ways to interact with GUI widgets.
In addition to the AutoIt.chm help file — which is the offline version of the online doco —, the wiki, the forum, and the source code examples in \AutoIt3\Examples, information can also be found in the following:
There are no more recent books to learn (but then, AutoIt isn't updated very frequently), and the help file is mostly a reference manual not a tutorial, although each function does include one or more examples.
A possible plan to learn AutoIt:
As of version 3.3.6.1, AutoIt consists in the following programs:
To install UDFs, if you're using SciTE4AutoIt3, it's better to create a new directory outside the AutoIt folder so that the files aren't affected when upgrading AutoIt. To tell SciTE to find those files, use Tools > SciTE Config, and fill the "User Include Folders" in the "General 1" tab.
AutoIt's original raison d'être.
Use install\Au3Info.exe.
Check UIASpy - UI Automation Spy Tool
There are two parts: Its Title, and "Text" which can be any text found in the window (buttons, textboxes, etc.)
WinWaitActive("Untitled - Notepad", "This is some text!")
Timeout can be increased thusly:
Opt("WinWaitDelay", 1)
Opt("WinTitleMatchMode", 1) ;1=start (default), 2=subStr, 3=exact, 4=advanced (deprecated), -1 to -4=Nocase
Note: Opt() = AutoItSetOption()
More information here.
https://www.autoitscript.com/autoit3/docs/functions/WinExists.htm
https://www.autoitscript.com/autoit3/docs/functions/WinWait.htm
https://www.autoitscript.com/autoit3/docs/functions/WinActive.htm
https://www.autoitscript.com/autoit3/docs/functions/WinActivate.htm
https://www.autoitscript.com/autoit3/docs/functions/WinWaitActive.htm
_WinWaitActivate() is not a native function: It is generated by the Au3Record.exe application, which no longer ships with AutoIt "from v3.3.14.1 as it triggers many AV false positives".
Launch \Extras\Au3Record\Au3Record.exe to record an action that Au3Record will then save as source code that you can use in your scripts.
Caution: Code generated Au3Record isn't always reliable, some functions won't work. YMMV.
Note: _WinWaitActivate() is not part of AutoIt; Its code found below must be included in the script.
Note: "AutoIt Recorder utility is not available from AutoIt Version 3.3.14.1." (source)
;CTRL+A
Send("^a")
Sleep(3000)
;CTRL+C
Send("^c")
;CTRL+V
Send("^v")
;jump to first line in text
Send("^{HOME}")
ControlSend("Untitled - Notepad", "", "Edit1", "This is some text")
ControlClick("My Window", "", "[ID:254]")
http://www.autoitscript.com/autoit3/docs/functions/ControlCommand.htm
http://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm
http://www.autoitscript.com/autoit3/docs/functions/ControlFocus.htm
(only as last resort)
http://www.autoitscript.com/autoit3/docs/functions/Send.htm
http://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm
Besides the Control*() functions, there are also: StatusbarGetText, WinActivate, WinGetClassList, WinMenuSelectItem.
ControlSend("Untitled - Notepad", "", "[CLASSNN:Edit1]", "This is some text")
ControlSetText("My Window", "", "[NAME:textBoxFolder]", "C:\Some\Folder")
ControlClick("My Window", "", "[ID:254]")
ControlClick("My Window", "", "[CLASS:Button; TEXT:Finish; INSTANCE:2]")
Note: ControlSetText() sometimes doesn't work as expected; If that case, try ControlSend() instead.
The EXE is about 1MB, and its size can be halved further through UPX.
#include <StringConstants.au3>
Local $sAnswer = InputBox("Type anything", "My text")
if not $sAnswer Then Exit ConsoleWrite("Closed inputbox" & @CRLF)
$sAnswer = StringStripWS($sAnswer,$STR_STRIPLEADING + $STR_STRIPTRAILING + $STR_STRIPSPACES)
;Two items expected
If $aArray[0] <> 2 Then Exit ConsoleWrite("Expected two items, got " & UBound($aArray)& @CRLF)
Local $item1 = $aArray[1]
Local $item2 = $aArray[2]
Local $sFileSelectFolder = FileSelectFolder("Select a folder", "")
If @error Then Exit ConsoleWrite("Closed directory dialog" & @CRLF)
#include <File.au3>
$aArray = _FileListToArrayRec($sFileSelectFolder, "*.jpg", $FLTAR_FILES , $FLTAR_RECUR, $FLTAR_NOSORT,$FLTAR_FULLPATH )
If UBound($aArray) = 0 Then Exit ConsoleWrite("zero elements") ;1D array only
ConsoleWrite(@ScriptLineNumber & @CRLF)
Variables are stored as variants, must start with the $ character and may only contain letters, numbers and the underscore _ character. Note that all variable names are case insensitive: MyVariable() is the same as MyvARiAblE(). Variables are declared and created with the Local and Global keywords - Dim can also be used, although this is not recommended. Although all variables outside functions are automatically Global, and all variables inside functions are Local, it's good practice to use the right keyword.
Constants are declared and created using Const keyword and must be initialised with a value.
To refer to macros such as environment variables: @ComputerName
Although not required, it's best practise to start a user defined function name with the underscore “_” to differentiate it from prebuilt functions, eg. _myFunction().
It's a good idea to use "Opt('MustDeclareVars', 1)" to make sure variables are always declared. Or even better: Use the following type of command to tell AutoItWrapper to call Au3Check.exe:
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 3 -w 4 -w 5 -w 6
Launch the SciTE editor in install\SciTe\SciTE.exe
To clear the console window in SciTE, use SHIFT+F5. To check a script's syntax without running it, use CTRL+F5.
Use ";"
SciTE/AutoIt provides three options to comment a block of lines; Only the first option provides a way to uncomment
In addition, AutoIt provides a fourth way to comment a block of text:
MsgBox($MB_OK, "Passed Parameters", $CmdLine[0] & " parameters have been passed to this script:")
For $i = 1 To $CmdLine[0]
MsgBox($MB_OK, "Passed Parameters", "Parameter " & $i & ": " & $CmdLine[$i])
Next
;Get input file
If $CmdLine[0] == 1 and $CmdLine[1] and FileExists($CmdLine[1]) Then
$INPUTFILE = $CmdLine[1]
EndIf
; Disable user input from the mouse and keyboard.
BlockInput($BI_DISABLE)
; Blah
BlockInput($BI_ENABLE)
"my " & _
"long string"
#include <StringConstants.au3>
;to remove spaces within, add + $STR_STRIPSPACES
Local $sString = StringStripWS(" Blah ", $STR_STRIPLEADING + $STR_STRIPTRAILING)
MsgBox($MB_SYSTEMMODAL, "", $sString)
The array.au3 UDF offers extended functions to handle arrays, eg. _ArrayDisplay($myarray)
Enum is a way to mimic dictionary arrays:
#include <Constants.au3>
#include <MsgBoxConstants.au3>
#include <Date.au3>
#include <Clipboard.au3>
ClipPut(_NowTime())
Local $sClipboard = ClipGet()
MsgBox($MB_SYSTEMMODAL, "Clipboard", $sClipboard)
Pasting the clipboard with ClipPut() or send("^v") is much faster than sending text via send().
Since send() is a blocking function, it's not supposed to proceed until it's done sending the text anyway.
For $i = 5 To 1 Step -1
MsgBox($MB_SYSTEMMODAL, "", "Count down!" & @CRLF & $i)
Next
Sleep(1000) ; sleep for 1s
#include <Misc.au3>
CHECK MouseMove(@DesktopWidth/2, @DesktopHeight/2)
To include files: #include <myfile.au3>
To include an external file into the AutoIt output EXE à la NSIS: FileInstall(Source,Destination[,flag])
#include <FileConstants.au3>
$sFileName = @ScriptDir &"\Test.txt"
$hFilehandle = FileOpen($sFileName, $FO_OVERWRITE)
If FileExists($sFileName) Then
MsgBox($MB_SYSTEMMODAL, "File", "Exists")
Else
MsgBox($MB_SYSTEMMODAL, "File", "Does not exist")
EndIf
FileWrite($hFilehandle, "This is line 1")
FileFlush($hFilehandle)
MsgBox($MB_SYSTEMMODAL, "File Content", FileRead($sFileName))
FileClose($hFilehandle)
;FileDelete($sFileName)
Exit
Exit(1)
Exit(2)
If some_error Then Exit MsgBox($MB_SYSTEMMODAL, "You have an error", "Some text")
A first example:
There is apparently no way to configure PCRE externally for the duration of a script, ie. without adding settings to every single pattern.
Note: The PCRE regex engine that AutoIt uses is single-line by default. If you need to find a pattern in a multi-line string, you must tell PCRE explicitely: Prepend (?m) for multi-line:
Here's how to extract the second part in a two-item string with a TAB delimiter:
To find and replace patterns:
The flag can have five different values:
$STR_REGEXPARRAYMATCH returns an array of matches while $STR_REGEXPARRAYFULLMATCH returns an array of matches including the full match (Perl / PHP style).
$STR_REGEXPARRAYFULLMATCH and $STR_REGEXPARRAYGLOBALFULLMATCH include the full matching text as the first element of the return array, while $STR_REGEXPARRAYMATCH and $STR_REGEXPARRAYGLOBALMATCH only return the captured groups.
$STR_REGEXPARRAYGLOBALMATCH returns an array of global matches while $STR_REGEXPARRAYGLOBALFULLMATCH returns an array of arrays containing global matches including the full match (Perl / PHP style).
Here's how to see what each option does:
As a reference, here's how to perform the same kind of search with string functions:
Func _MakeString()
Local $aSplit = StringSplit('abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', '')
Local $sHoldString = ''
For $iCC = 1 To Random(10, 15, 1)
$sHoldString &= $aSplit[Random(1, 62, 1)]
Next
Return $sHoldString
EndFunc
#include <WinAPICom.au3>
ConsoleWrite(_WinAPI_CreateGUID() & @CRLF)
#include <AutoItConstants.au3>
#include <ColorConstants.au3>
#include
<Constants.au3>
#include <DirConstants.au3>
#include <EditConstants.au3>
#include
<FileConstants.au3>
#include <FontConstants.au3>
#include
<GUIConstantsEx.au3>
#include <InetConstants.au3>
#include
<MsgBoxConstants.au3>
#include <ProcessConstants.au3>
#include
<StaticConstants.au3>
#include <StringConstants.au3>
#include
<WindowsConstants.au3>
Global Const $MB_OK = 0 ; One push button: OK
Global Const $MB_OKCANCEL = 1 ; Two push buttons: OK and Cancel
Global Const $MB_ABORTRETRYIGNORE = 2 ; Three push buttons: Abort, Retry, and Ignore
Global Const $MB_YESNOCANCEL = 3 ; Three push buttons: Yes, No, and Cancel
Global Const $MB_YESNO = 4 ; Two push buttons: Yes and No
Global Const $MB_RETRYCANCEL = 5 ; Two push buttons: Retry and Cancel
Global Const $MB_CANCELTRYCONTINUE = 6 ; Three buttons: Cancel, Try Again and Continue
Global Const $MB_HELP = 0x4000 ; Adds a Help button to the message box. When the user clicks the Help button or presses F1, the system sends a WM_HELP message to the owner.
; Displays an icon in the message box
Global Const $MB_ICONNONE = 0 ; Stop-sign icon
Global Const $MB_ICONSTOP = 16 ; Stop-sign icon
Global Const $MB_ICONERROR = 16 ; Stop-sign icon
Global Const $MB_ICONHAND = 16 ; Stop-sign icon
Global Const $MB_ICONQUESTION = 32 ; Question-mark icon
Global Const $MB_ICONEXCLAMATION = 48 ; Exclamation-point icon
Global Const $MB_ICONWARNING = 48 ; Exclamation-point icon
Global Const $MB_ICONINFORMATION = 64 ; Icon consisting of an 'i' in a circle
Global Const $MB_ICONASTERISK = 64 ; Icon consisting of an 'i' in a circle
Global Const $MB_USERICON = 0x00000080
; Indicates the default button
Global Const $MB_DEFBUTTON1 = 0 ; The first button is the default button
Global Const $MB_DEFBUTTON2 = 256 ; The second button is the default button
Global Const $MB_DEFBUTTON3 = 512 ; The third button is the default button
Global Const $MB_DEFBUTTON4 = 768 ; The fourth button is the default button.
; Indicates the modality of the dialog box
Global Const $MB_APPLMODAL = 0 ; Application modal
Global Const $MB_SYSTEMMODAL = 4096 ; System modal
Global Const $MB_TASKMODAL = 8192 ; Task modal
; Indicates miscellaneous message box attributes
Global Const $MB_DEFAULT_DESKTOP_ONLY = 0x00020000 ; Same as desktop of the interactive window station
Global Const $MB_RIGHT = 0x00080000 ; The text is right-justified.
Global Const $MB_RTLREADING = 0x00100000 ; Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.
Global Const $MB_SETFOREGROUND = 0x00010000 ; The message box becomes the foreground window
Global Const $MB_TOPMOST = 0x00040000 ; The message box is created with the WS_EX_TOPMOST window style.
Global Const $MB_SERVICE_NOTIFICATION = 0x00200000 ; The caller is a service notifying the user of an event.
Global Const $MB_RIGHTJUSTIFIED = $MB_RIGHT ; Do not use, see $MB_RIGHT. Included for backwards compatibility.
; Indicates the button selected in the message box
Global Const $IDTIMEOUT = -1 ; The message box timed out
Global Const $IDOK = 1 ; OK button was selected
Global Const $IDCANCEL = 2 ; Cancel button was selected
Global Const $IDABORT = 3 ; Abort button was selected
Global Const $IDRETRY = 4 ; Retry button was selected
Global Const $IDIGNORE = 5 ; Ignore button was selected
Global Const $IDYES = 6 ; Yes button was selected
Global Const $IDNO = 7 ; No button was selected
Global Const $IDCLOSE = 8 ; Close button was selected
Global Const $IDHELP = 9 ; Help button was selected
Global Const $IDTRYAGAIN = 10 ; Try Again button was selected
Global Const $IDCONTINUE = 11 ; Continue button was selected
Relies on the Windows key + "b", and moving to the app's index through the right arrow
#include <SysTray_UDF.au3> ;https://www.autoitscript.com/forum/topic/13704-systray_udf/
;highly modified version : https://www.autoitscript.com/forum/topic/103871-_systray-udf/
Const $MYAPP = "myapp.exe"
Const $MYAPP_WINDOW = "[TITLE:Blah; CLASS:Blah]"
Local $index = _SysTrayIconIndex ($MYAPP)
if not $index then Exit ConsoleWrite($MYAPP & " not found." & @CRLF)
ConsoleWrite(StringFormat("Index: %s" & @CRLF,$index))
Send('{LWINDOWN}b{LWINUP}')
Sleep(500)
Send('{RIGHT ' & $index & '}{ENTER}')
Sleep(500)
WinActivate(MYAPP_WINDOW)
AutoIt can be used to write graphical applications. As of 2018, there are two ways to do this: Either by writing your own code directly, or by using any of the numerous GUI creators such as GuiBuilderPlus (under current development) or the Koda GUI designer — which is included in the AutoIt installer, but hasn't been updated since 2010. Note that GUI designers only handle the GUI, not the code of the application: Any change you make to the GUI must be retrofitted into the application.
Some sources to learn how to write GUIs in AutoIt:
AutoIt supports the following widgets:
Two ways to handle events: MessageLoop mode (default; actively polls the GUIGetMsg function; best for GUIs where the GUI is "king" and all you care about is waiting for user events) and OnEvent mode (enabled with Opt("GUIOnEventMode", 1); best for GUIs where the GUI is of secondary importance and your script has other tasks to perform in addition to looking after the GUI).
Here's how to create the GUI, perform some tasks, and then wait until the user hits the Esc key to close the app:
Using the third option is used and setting it to "1" puts the carret at then end before appending text.
Use this to include a vertical scroll bar:
Here's how to empty controls by relying on the fact that each control is assigned an integer that is incremented with each time control:
Move caret to the beginning:
GuiCtrlSendMsg($INPUTCTRL, $EM_SETSEL, 0, 0)
$sOptions = ((GUICtrlRead($BITRATE) = $GUI_CHECKED) ? "-b:v 450k ": "")
The GUICtrlCreateGroup() assumes that widgets that follow belong to the group, with no need to specify the group's handle. The group will take of selecting/unselecting the buttons:
A simple way to check which of two buttons is selected:
To keep the GUI responsive while launching a long-running task:
Alternatives: Run the GUI in OnEventMode by launching the task when pushing a button, or launch the long-running task in a thread (forum):
ADD thread mode here
_GUICtrlListBox_BeginUpdate($idListBox)
...
_GUICtrlListBox_EndUpdate($idListBox)
The progress bar expects a maximum of 100
If max is not 100:
Don't specify the "left,top" params, or even the "width,heigh":
$Form1 = GUICreate("Blah", 397, 357)
$Form1 = GUICreate("Blah")
Simplest code:
Alternative:
Don't use Sleep in an inner loop. According to the help file, a call to sleep() isn't necessary since GuiGetMsg() " automatically idles the CPU when required so that it can be safely used in tight loops without hogging all the CPU."
The window contains a single widget, just to output text:
This works, but it doesn't close when the user hits the Escape key, and doesn't support MsgBox():
The Help file contains two sections: "Obj/COM Reference", and "Obj/COM
functions Reference". Since they're not part of AutoIt, and hence auto-completion
isn't available, working with COM
objects requires reading their respective documentations to figure things out.
In
addition to Obj*() and IsObj(), AutoIt provides two extra syntaxes to make things
easier: With..EndWith, and For..In (the latter can also be used with AutoIt's
arrays, not just COM objects; The For..In syntax is needed to enumerate a collection's
elements).
There are two ways to handle COM errors: Using a generic error function by AutoIt, or the object's specific events.
Not all Object support events, if any. AutoItCOM can only receive 'dispatch' type events. Also, you need to know the names of the Events the Object could generate, including their arguments. Here's an example:
COM objects are automatically released when the script exists, but they can be released manually by assiging a value of zero:
The "OLE/COM
Object Viewer" (more
infos) is a handy tool to get a peek on all COM libraries
currently installed on your system. By default, oleview.exe will be installed in C:\Program
Files\Resource Kit\. It requires downloading the IVIEWERS.DLL
file separately.
Surprisingly, the OLE/COM Object Viewer application doesn't
provide a search function: To find an object, you'll have to manually look it
up in the Type Libraries section, eg. "Microsoft XML" — start typing
to find an object. Right-clicking
can copy its GUID into the clipboard, which can then be looked for in the Registry.
The "VersionIndependentProgID" info is to be used when calling Obj*().
"AutoIt uses the IDispatch interface for automation. This interface 'exposes' all scriptable methods and properties that the object supports. If there is no IDispatch interface for an object, you can't use the object in an AutoIt script." Note: For some reason, the application returns this error when right-clicking on an object's IDispatch interface: "IDataObject interface viewer only supports IID_IDataObject.
Some information about the Viewer is available in the help file's "Obj/COM Reference" section.
Some COM resources on the internet:
As of 2023, the best solution is to work directly with Microsoft's MSXML COM server through AutoIt's ObjCreate(). mLipok's XML.au3 UDF wrapper (Previously XMLWrapperEx.au3) to Microsoft.XMLDOM (msxmlX.dll is currently at version 6) is incomplete and hasn't been updated since 2017. If you don't need to save changes back to XML, TheXman's jq.au3 can convert XML to JSON using jq.exe.
Important: If search fails even though the XPath is correct, it could be due to namespaces. To check, either get rid of them in the input file, or use a regex for that purpose — StringRegExpReplace(FileRead($XML_FILE), "(xmlns:?[^=]*=[""][^""]*[""])", "") .
List of UDF's:
If you don't know how to work with XML, it can't hurt to first read a bit about MSXML and DOM, along with XPath.
As of 2023, the latest release is 1.1.1.13 from March 2017. It requires including xml.au3 and ADO_CONSTANTS.au3. _XMLDomWrapper_1.0.3.98_CN.au3 is only included for historical reference.
Sources to learn:
Before asking for help in the thread, make sure you use the latest release of the UDF, and provide the versions of msxmd.dll, the UDF, AutoIt, and SciTE you're using. If you get a "Automation server can't create object", make sure msxml.dll is actually installed, and up to date.
To find data, use XPath to the max.
That UDF might be good enough for your needs, although development stopped in 2017, and some functions are either not as easy to use as they should be, or missing altogether:
Since multiple UDFs were written over time, I assume working with MSXML exclusively through a COM object is much harder — or people wouldn't have bothered. Regardless, since XML is getting a bit old, an alternative could be to convert XML to JSON, and use JSON functions instead.
A function returns either OK/NOK, a string, an array, or a collection — a collection might need to be turned into an array before further use (after always checking for for success/error) eg. _XML_GetAllAttribIndex() + _XML_Array_GetAttributesProperties().
ConsoleWrite("UDF Version: " & _XML_MiscProperty_UDFVersion() & @CRLF)
ConsoleWrite(_XML_MiscProperty_Encoding() & @CRLF)
$oXmlDocIn = _XML_CreateDOMDocument() ; create object
_XML_Load($oXmlDocIn, "myfile.xml") ;To read from a string, use _XML_LoadXML()
ConsoleWrite(_XML_Tidy($oXmlDocIn) & @CRLF)
Note: "The standalone="no" directive comes from the _XML_Tidy command"
To get just a single node:
To get multiple nodes:
? No way to update element's value through its pointer from _XML_SelectSingleNode()?
; Name ..........: _XML_UpdateField
; Description ...: Update existing single node based on XPath specs.
; Name ..........: _XML_UpdateField2
; Description ...: Update existing node(s) based on XPath specs.
CHECK
What does it add to MSXML.DLL that can't be used directly through COM? Can't AutoIt work with COM objects?
Does MSXML handle HTML?
Is XPath always required to search for nodes?
How to read, navigate, edit? All through XPath, no equivalent to BS' find_(all)?
Does case matter, eg. are _XML_LoadXML() and _XML_LoadXml() the same? _XML_TIDY() vs. _XML_Tidy()?
What's the diff? ConsoleWrite($oXMLDocIn.xml) vs. ConsoleWrite($oXMLDocIn)
Why is encoding="UTF-8" gone in header when reading XML file?
Why does the UDF/MSXML add "standalone="no"" in the XML header?
What if XPath returns more than one element when calling selectSingleNode()? Is only the first one read?
An alternative to Microsoft's MXSML DLL is to use the TheXman's Powerful and flexible JSON Processing jq UDF
wrapper to jq.exe (January 2019;
jq.au3), and Xml2Json
to convert XML to JSON (xml2json.au3). To get/set data, it relies on jq's filters.
Note that converting XML to JSON removes the difference
between attribute and text (<element attribute="foo">bar</element>),
and some XML files may need custom stylesheets or may need the XML file
to be modified before transformation.
Provided there's a simple UDF to convert XML to JSON, it might be possible
to use AspirinJunkie's JSON.au3
and get rid of the dependency on jq.exe. If not, it still offers the benefit
of AutoIt syntax instead of jq filters to work with JSON.
Besides JSON having no notion of XML attributes, JQ — and therefore this UDF — can not save data back into XML.
2009 JSON (by Gabriel13) - RFC4627 compliant JSON encode/decode.
2013 JSON (by Ward) - JSMN - A Non-Strict JSON UDF. "jsmn (pronounced like 'jasmine') is a minimalistic JSON parser in C. It can be easily integrated into resource-limited or embedded projects."
2013 JSON (by ozmike) - Bridge to Native Windows JSON plus OO extension for AutoIt.
2015 JSONgen: JSON generator (by Jefrey) - UDF to generate JSON.
2019 jq (by TheXman) - Brings the power and flexibility of jq (an open-source command-line based JSON processor) to AutoIt.
2023 JSON (by AspirinJunkie) - Interacting with JSON data in AutoIt. "Probably the most common method to deal with JSON in AutoIt is the variant via JSMN. My minor dissatisfactions with this approach led me to write this UDF in the first place a few years ago." (no need for jsmn/jq binary?)
If you only want to run an application and don't need to display the output in real time:
A simpler alternative to a full-fleged GUI just to output text is to use SplashTextOn/Off():
Using a basic GUI with just an Edit box:
Wait for item in StdOut
Write
GOTO 10
NO DOS https://www.autoitscript.com/forum/files/file/351-learn-to-program-using-free-tools-with-autoit/
NO TUTORIAL ON DOS https://www.autoitscript.com/autoit3/docs/
NO TUTORIAL ON DOS Learning to Script with AutoIt V3 (Last Updated 17 Feb 2010).zip
Autoit-1-2-3 http://www.autoitscript.com/forum/index.php?act=attach&type=post&id=10824
Run()
If you…
When is StdioClose() required/recommended?
Why use "@ComSpec"? Run(@ComSpec & " /C DIR c:\test1")
What is a Console application?
Run*() vs. ShellExecute*()?
Missing CRLF in StdOut()?
Do Std*() still contain data after running RunWait()?
Do StOut*() contain all the data after running RunWait(), or are their buffers limited in size, and will only contain the latest data after RunWait() exits? In that case, what is the right way to use Str*Read() to not miss any?
What is the right way to interact with a CLI app using StdInWrite() + Std*Read()?
How to read Stdout and Stderr separately, to know what an error occured?
How many bytes can the Stdout buffer contain?
Is there a risk of missing bytes while reading the Stdout buffer?
AutoIt provides multipe UDFs to work with SQLite. Confusingly, the one included in the installer provides multiple ways to send a SELECT, but the experts say that Exec() should be used to write (INSERT, UPDATE, DELETE), GetTable[2d] should be used to read (SELECT), while Query*() + Fetch*() should be ignored entirely, although _SQLite_QuerySingleRow() works fine to fetch a single row:
SQLite.au3 should always be included, but SQLite.dll.au3 is optional and seems to be used in _SQLite_SQLiteExe to access SQLite through its EXE instead of the DLL ("If included, the SQLite version is used.").
As of 2023, there are two solutions currently maintained:
IUIAutomation can be used for multiple applications, and is based on the Microsoft automation API
WebDriver UDF : AutoIt solution to use the Selenium WebDriver interface for automation. Most popular browser support automation via this method, @Danp2 wrote a UDF for that. Incidently, Selenium's WebDriver can also be use with Python or Javascript. Alternative to Selenium IDE, which is a browser extension (Selenium RC was merged into WebDriver.)
Important: All the required files above must be unzipped at the root of your "User Include Folder", ie. where you keep your personal UDF files, so that wd_demo.au3 can find them — It won't look in sub-directories.
The wd_demo.au3 is used to check that everything works OK, while wd_core.au3 and wd_helper.au3 contain code that you need to drive a browser.
As of April 2021, there seems to be no tutorial. To learn how to use the WebDriver UDF:
$oOutlook = ObjCreate("Outlook.Application")
https://www.autoitscript.com/forum/topic/126357-outlookex-udf-help-support/
After installing OutlookEX UDF per its Readme, run Outlook, and use the following script to read the data from its To-Do List panel, sorted through Last Modified:
If you do want to make manual changes to SciTE settings, it is best to do
this in the "User Option File" because the installation of a new version
will override the settings of the SciteGlobal.properties and au3.properties
files. See the SciTE Documentation for all possible settings and User Options
File for more details. All of these Configuration files can be found under the
<Options> menu.
https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/Scitedoc/SciTEDoc.html
https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/SciTE4AutoIt3-user-options-file.html
Hit CarriageReturn : sometimes (eg. Else/EndIf), SciTE doesn't line up as expected (always lines up at col 0), so user hit TAB one or more times SciTE.AutoIt.wrong.indent.png
AutoIt: Always check for undeclared and unused variables? In au3.properties?
https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3.html
Edit C:\Users\blah\AppData\Local\AutoIt v3\SciTE\SciTEUser.properties to overrule the following parameter:
Do not edit C:\Program Files (x86)\AutoIt3\SciTE\SciTEGlobal.properties
myscript..au3 (1) : ==> Unknown function name.: _WinWaitActivate("classname=TfrmPref","")
If you just copy/paste the output instead of what's actually saved in a file, you'll be missing some User-defined functions (UDF) that Au3Record relies on:
There is a bug with release 3.3 which uses "classname=myclass" instead of "[CLASS:myclass]".
Compile displays a dialog to set options, while Build doesn't.
No PDF or CHM for tutorial? https://www.autoitscript.com/autoit3/docs/
Pressing Ctrl-F5 will run Tylo's AutoIt3 syntax checker, which will syntax check the script.
Compile (CTRL+F7): Compile with options allowing to make all kinds of changes to the target EXE like Ico and resource information. Displays a dialog box to change parameters.
Build (F7): Compiles with default options. You can create an executable (.exe) of your script. SciTE will run the Aut2Exe program and compile the script. Run AutoIt3Wrapper which will run Au3Check first and then Aut2EXE. Optionally many other things defined by the #AutoIt3Wrapper_ Directives.
Go (F5): Pressing just F5 will run Au3Check and then, if no errors/warnings are found, run AutoIt3.exe to run the script.
In Scite, hit CTRL+F1 for more infos.
You must use "&", not "+":
The Send() function sends a string to whatever window is active, ie. it's not possible to tell it to only send data to a specific window. So if you're using a loop, add a WinWaitActive() to make sure you're no sending stuff in a totally different window:
It generates and pastes the code in SciTE (in test.au3), even after saving the GUI in a Koda file. Hitting F10 makes no difference.
So AU3Check doesn't complain with "declared, but not used in func", error UNREFED. Can be turned off (-w- 5)
No, but Enum is a work-around:
https://www.autoitscript.com/forum/topic/93732-forceref-answered/
AutoItSetOption("MustDeclareVars", 1)
Au3Stripper
Au3Check
In SciTE: Select Tools > Scite Config, click on the General 1 tab, and make sure "Choose default action for .au3 files" is set to "Run" instead of "Edit".