Control Flow | |
---|---|
Break LoopLabel | Break out of a loop or any number of nested loops. |
Continue LoopLabel | Continue a loop, even from within any number of nested loops. |
For x,y in z | Loop through the contents of an object. |
Loop Until | Loop until a condition is true. Applicable to any type of Loop. |
Commands | |
FileEncoding | Sets the default encoding for FileRead, FileReadLine, Loop Read, FileAppend, and FileOpen. See also: Text Encodings |
Menu, Icon | Sets or removes a menu item's icon. |
SendInput {U+nnnn} | Sends a Unicode character. Unicode characters may be used directly in Unicode builds. |
SetFormat, IntegerFast, h|H | Set lower-case or upper-case hexadecimal format. |
Transform, HTML | Perform code page or HTML transformations. |
Directives | |
#If expression | Similar to #IfWinActive, but for arbitrary expressions. |
#IfTimeout | Sets the maximum time that may be spent evaluating a single #If expression. |
#MenuMaskKey | Changes which key is used to mask Win or Alt keyup events. |
#Include <Lib> | Includes a script file from a function library folder. |
#Warn | Enables or disables warnings for selected conditions that may be indicative of developer errors. |
Functions | |
ComObj... -- ComObjActive ComObjEnwrap/Unwrap ComObjParameter ComObjType | Retrieves a registered COM object. Wraps/unwraps a COM object. Wraps a value and type to pass as a parameter. Retrieves a COM object's type information. |
ComObjArray | Creates a SAFEARRAY for use with COM. |
ComObjConnect | Connects a COM object's event sources to functions with a given prefix. |
ComObjCreate | Creates a COM object. |
ComObjError | Enables or disables notification of COM errors. |
ComObjFlags | Retrieves or changes flags which control a COM wrapper object's behaviour. |
ComObjGet | Returns a reference to an object provided by a COM component. |
ComObjQuery | Queries a COM object for an interface or service. |
ComObjType | Retrieves type information from a COM object. |
ComObjValue | Retrieves the value or pointer stored in a COM wrapper object. |
FileOpen | Provides object-oriented file I/O. |
IsObject | Determines if a value is an object. |
StrPut / StrGet | Copies a string to or from a memory address, optional converting it between code pages. |
Trim | Trims certain characters from the beginning and/or end of a string. |
RegEx (?CNumber:Function) | Calls a function during evaluation of a regex pattern. |
Variadic Functions | Functions may accept a variable number of parameters via an array. |
Objects | |
General | Behaviour and usage of objects in general. |
Object | Associative arrays which can be extended with other functionality. |
Enumerator | Allows items in a collection to be enumerated. |
File | Provides an interface to access a file. FileOpen returns an object of this type. |
ComObject | See ComObj functions above. |
Variables | |
A_IsUnicode | In Unicode builds, this variable contains 1 (true). In ANSI builds it is not defined, so is effectively false. |
A_FileEncoding | Contains the default encoding for various commands; see FileEncoding. |
A_OSVersion | Contains WIN_7 on Windows 7, else one of the values documented here. |
A_PtrSize | Contains the size of a pointer, in bytes. This is either 4 (32-bit) or 8 (64-bit). |
Datatypes | |
Ptr | Equivalent to Int in 32-bit builds and Int64 in 64-bit builds. Supported by DllCall, NumPut and NumGet. |
AStr, WStr | Supported only by DllCall; see Script Compatibility. |
Unicode | |
Compatibility | How to deal with Unicode in DllCall, etc. |
Script Files | Using Unicode in script files. |
SendInput | Using Unicode with SendInput. |
Other | |
Debugging | Interactive debugging features (line by line execution etc.). |
Icon Support | Resource identifiers and improved support for various icon sizes. |
Gui Text Quality | Control text anti-aliasing on a Gui. |
Other Changes | Changes affecting script compatibility. |
Version History | History of AutoHotkey_L revisions. |
FileRead, FileReadLine, Loop Read and FileAppend support the majority of Windows-supported text encodings, not just the system default ANSI code page. FileEncoding can be used to set the default encoding, which can be overridden for FileRead and FileAppend as follows:
FileRead, OutputVar, *Pnnn Filename FileAppend [, Text, Filename, Encoding]
While nnn must be a numeric code page identifier, Encoding follows the same format as FileEncoding.
See also: Script Compatibility
Icon resources of any size supported by the operating system may be extracted from executable files. When multiple sized icon resources exist within an icon group, the most appropriate size is used. Prior to revision 17, an arbitrary icon resource was selected by the system, scaled to the system large icon size, then scaled back to the requested size.
Negative icon numbers may be used to identify a group icon resource within an executable file. For example, the following sets the tray icon to the default icon used by ahk files:
Menu, Tray, Icon, %A_AhkPath%, -160