© 2019 Hotkeyit, Steve Gray, Chris Mallett, portions © AutoIt Team and various others
Software License: GNU General Public License
Commands / Functions | |
---|---|
#DllImport | Create an alias function for a dll function that allows to omit parameters and use default values. It can also load pure machine code supplied as hex string, see example. |
#WarnContinuableException | Do not warn on continuable exception, continue execution like main AutoHotkey does. |
#WindowClassMain | Change main window class from AutoHotkey to something different. |
#WindowClassGui | Change Gui window class from AutoHotkeyGUI to something different. |
AhkThread | Create a new thread using AutoHotkey.dll included in resources. |
Alias | Create ByRef variable or share variables to other threads in a multi-thread environment. |
BinRun | Run executable file from Memory. |
BinToHex | Convert binary data to Hex string. |
CreateScript | Create script from main script for NewThread, AutoHotkey.dll, BinRun or DynaRun. |
CriticalSection | Creates a Critical Section Structure and returns its pointer. Use EnterCriticalSection and LeaveCriticalSection to Enter and Leave the Critical Section. Critical Section is requred for multi-threading environment. |
CryptAES | Encrypt and Decrypt data. |
DirGetParent | Get parent directory of a file or directory. |
DynaRun | Run code dynamically in new AutoHotkey process. |
ErrorMessage | Get error message string of A_LastError. |
FileReplace | Similar to FileAppend but replaces the file if it exists. |
FindFunc (low level) | Get a pointer to a Function. |
FindLabel (low level) | Get a pointer to a label. |
#NoEnv / GetEnv | #NoEnv is now used in all scripts. Use GetEnv to add environment variables to script. |
GetEnv | Get environment variables and make global variables in script. |
HexToBin | Convert Hex string to binary memory. |
HIBYTE | Get high byte from a value. |
HIWORD | Get high word from a value. |
IsBOM | Check if a file has byte order mark. |
LOBYTE | Get low byte from a value. |
LOWORD | Get low word from a value. |
MAKELANGID | Make LANGID. |
MAKELCID | Make LCID. |
MAKELONG | Make LONG. |
MAKELPARAM | Make LPARAM. |
MAKELRESULT | Make LRESULT. |
MAKEWORD | Make WORD. |
MAKEWPARAM | Make WPARAM. |
MCodeH | Create machine code function. |
ResDelete | Delete a resource in executable file. |
ResDllCreate | Create a resource only dll file. |
ResExist | Check if a resource exists in executable file. |
ResPut | Add a resource to executable file from memory. |
ResPutFile | Add a file to resources of executable file. |
Send | Sleep functionality for Send command, for example Send 123{100}456 would send 123 then sleep for 100 milliseconds and send 456. |
sizeof | Returns the size in bytes for default data type, structure or structure definition, for example MsgBox % sizeof("TCHAR"). |
StrPutVar | Put an encoded string into a variable. |
ToChar | Convert an integer to signed char. |
ToInt | Convert an integer to signed integer. |
ToShort | Convert an integer to signed short. |
ToUChar | Convert an integer to unsigned char. |
ToUInt | Convert an integer to signed integer. |
ToUShort | Convert an integer to unsigned integer. |
VarSetCapacity | When the buffer size of a variable is changed and FillByte is not used and old and new capacity is > 1 byte, the original buffer content is kept/copied to the new buffer. |
WinApi | Use WinApi functions as if it was a build-in function. |
Zip Functions | Various zip functions to compress and uncompress files or data in memory. ZipCreateFile, ZipAddFile, ZipCloseFile, ZipCompressionLevel, UnZip, ZipCreateBuffer, ZipAddBuffer, ZipCloseBuffer, UnZipBuffer, ZipRawMemory, UnZipRawMemory, ZipInfo, ZipOptions, ZipAddFolder |
Gui | Gui related features |
Auto positioning and resizing of controls | Controls can be automatically positioned and resized when Gui is resized. Controls will be positioned and resized relatively to the initial size of Gui (Gui, Show).
The following auto position options are supported:AX: Move the control horizontally by a specified amount when the Gui changes width. AY: Move the control vertically by a specified amount when the Gui changes height. AXP and AYP: Move the control by the same amount that the previous control moved. AXA and AYA: Move the control by the same amount that the previous control moved and resized so the control is placed right after or below previous control. AXR and AWR: Reset horizontal repositioning. AYR and AHR: Reset vertical repositioning. The following auto size options are supported:AW: Resize the control width by an amount relative to the change in Gui width. AH: Resize the control height by an amount relative to the change in Gui height. AWA and AHA: Resize the control width or height by the same amount as previous control. |
Gui Scroll options | Scroll: Enable vertical and horizontal Scroll bars for gui. VScroll: Enable vertical Scroll bar. HScroll: Enable horizontal Scroll bar. |
Objects | |
ComObjDll | Creates a COM Object from a COM dll. |
CriticalObject | Create multi-thread save object. |
InputHook Option A | When using option A, previous input or text set via MyInputHook.Input := Text will not be discarded, instead new input will be appended to the text. |
DynaCall | Imports a Dll function and defines its parameters so we don't need to define on each call like in DllCall. |
ObjByRef | Save variables by reference in object. |
ObjDump | Dump an object to memory or file. |
ObjLoad | Load a dumped object from memory or file. |
ObjShare | Create multi-thread save COM IDispatch proxy object. |
Struct | Creates C++ like Structure object that is accessed and modified using object syntax. |
MemoryModule | Allows loading a dll from Memory, e.g. Resource. |
MemoryFindResource | Similar to FindResource. |
MemoryFreeLibrary | Similar to FreeLibrary for MemoryModule. |
MemoryGetProcAddress | Similar to GetProcAddress for MemoryModule. |
MemoryLoadLibrary | Similar to LoadLibrary but loads a dll from memory. This allows real multi-threading by loading loading a dll multiple times. |
MemoryLoadResource | Similar to LoadResource. |
MemoryLoadString | Similar to LoadString. |
MemorySizeofResource | Similar to SizeOfResource for MemoryModuel. | Variables |
NULL | New built-in, variable same as FALSE. Resolves to 0. |
A_AhkDir | returns the path of current exe. |
A_IsDll | returns 1 (true) if called from AutoHotkey.dll and FALSE/NULL/0 otherwise. |
A_DllPath | returns the path of current module (dll or exe). |
A_DllDir | returns the path of current module (dll or exe). |
A_ModuleHandle | Equivalent to GetModuleHandle(NULL) but returns the correct ModuleHandle for AutoHotkey.dll when using MemoryModule |
A_ScriptStruct | returns pointer to internal g_script structure. |
A_GlobalStruct | returns pointer to internal g structure. |
Compiling | |
Compiling AutoHotkey | Original
AutoHotkey is only capable to be compiled with AutoHotkeySC.bin. In
AutoHotkey_H any AutoHotkey binary (AutoHotkey.dll,
AutoHotkey.exe, AutoHotkeySC.bin) can be compiled. This allows keeping full functionality of AutoHotkey including executing other scripts. Compiled AutoHotkey.exe and AutoHotkey.dll can use /E switch to execute different script than compiled one. |
Ahk2Exe | Custom version of fincs Ahk2Exe compiler with support for AutoHotkey_H features. |
Resource Library | You can include
library functions in resource of exe or dll (Resorce type must be "LIB", e.g. LIB/WATCHDIRECTORY.AHK). Additionally AutoHotkey.dll can load library functions from exe file automatically (Note both execuables must be using same password if source is encrypted). Note, this is not supported by AutoHotkeySC.bin. |
Resource Compression and Encryption | Ahk2Exe supports compression and encryption for resource files, AutoHotkey will decompress and decrypt the files internally automatically. UnZipRawMemory can be used to decompress and decrypt resources in Script. |
AutoHotkey.dll Module | |
AutoHotkey.dll | AutoHotkey Module with COM support that can be used for multi-threading and allows AutoHotkey to be embedded into another applications. It provides AutoHotkey functionality that might be more difficult to implement in another language. |
Exported Functions | Available for AutoHotkey.exe and AutoHotkey.dll |
addFile | Add and optionally execute additional script/code from file. Not available for scripts compiled with AutoHotkeySC.bin. |
addScript | Add and optionally execute additional script/code from text/memory/variable. Not available for scripts compiled with AutoHotkeySC.bin. |
ahkassign | Assign a value to variable or pointer of variable. |
ahkExec | Execute some script/code from text/memory/variable temporarily. Not available for scripts compiled with AutoHotkeySC.bin. |
ahkExecuteLine | Executes script from given line pointer. |
ahkFindFunc | Find a function and return its pointer. |
ahkFindLabel | Find a label and return its pointer. |
ahkFunction | Call a function via SendMessage method. Mainly used with AutoHotkey.dll to call a function in dll script or call a function in main script from dll. |
ahkgetvar | Retrieve a value from a variable. |
ahkLabel | Goto (PostMessage) or Gosub (SendMessage) a Label. Also used mainly with AutoHotkey.dll |
ahkPause | Pause Script. |
ahkPostFunction | Call a function via PostMessage method (does not wait until function returns). Also used mainly with AutoHotkey.dll |
Exported Functions | Available only in AutoHotkey.dll |
ahkdll and ahktextdll | Load a new thread from a file or string/memory/variable, current thread will be terminated. |
ahkReady | Returns 1 (true) if a thread is being executed currently, 0 (false) otherwise. |
ahkReload | Reload thread using same parameters used with ahkdll or ahktextdll. |
ahkTerminate | Terminate thread. |
7-zip.dll Module | |
7-zip.dll | 7-zip.dll module for advanced compression and decompression tasks. |
Other | |
ahk_parent | Allow to identify the right window if multiple window with same criteria exist, ahk_parent must be followed by space and Window Id. ahk_parent can be used in any Win... and Control... functions. For example WinActivate, ahk_class #32770 ahk_parent 0x3F4A5 |
& | Retrieve pointer to any String or build in variable like &A_LoopField or &"Text". |
In addition to the user library in %A_MyDocuments%\AutoHotkey\Lib
,
standard library in the AutoHotkey directory and local library which
resides in %A_ScriptDir%\Lib
functions may be
auto-included from a folder that %A_AhkExeDir%\lib.lnk points to. For
more information, see Libraries
of Functions.
Static variables are saved in separate array internally for better performance. Also ListVars shows static and local variables separately.
A special thanks to Jonathan Bennett, whose generosity in releasing AutoIt v2 as free software in 1999 served as an inspiration and time-saver for myself and many others worldwide. In addition, many of AutoHotkey's enhancements to the AutoIt v2 command set, as well as the Window Spy and the old script compiler, were adapted directly from the AutoIt v3 source code. So thanks to Jon and the other AutoIt authors for those as well.
Finally, AutoHotkey would not be what it is today without these other individuals.
~ Chris Mallett