└── docs ├── 404.htm ├── AHKL_DBGPClients.htm ├── ChangeLog.htm ├── Compat.htm ├── Concepts.htm ├── FAQ.htm ├── Functions.htm ├── HotkeyFeatures.htm ├── Hotkeys.htm ├── Hotstrings.htm ├── KeyList.htm ├── Language.htm ├── ObjList.htm ├── Objects.htm ├── Program.htm ├── Scripts.htm ├── Tutorial.htm ├── Variables.htm ├── howto ├── Install.htm ├── ManageWindows.htm ├── RunExamples.htm ├── RunPrograms.htm ├── SendKeys.htm └── WriteHotkeys.htm ├── index.htm ├── lib ├── A_Clipboard.htm ├── A_HotkeyModifierTimeout.htm ├── A_MaxHotkeysPerInterval.htm ├── A_MenuMaskKey.htm ├── Any.htm ├── Array.htm ├── Block.htm ├── BlockInput.htm ├── Break.htm ├── Buffer.htm ├── CallbackCreate.htm ├── CaretGetPos.htm ├── Catch.htm ├── Chr.htm ├── Class.htm ├── Click.htm ├── ClipWait.htm ├── ClipboardAll.htm ├── ComCall.htm ├── ComObjActive.htm ├── ComObjArray.htm ├── ComObjConnect.htm ├── ComObjFlags.htm ├── ComObjFromPtr.htm ├── ComObjGet.htm ├── ComObjQuery.htm ├── ComObjType.htm ├── ComObjValue.htm ├── ComObject.htm ├── ComValue.htm ├── Continue.htm ├── Control.htm ├── ControlAddItem.htm ├── ControlChooseIndex.htm ├── ControlChooseString.htm ├── ControlClick.htm ├── ControlDeleteItem.htm ├── ControlFindItem.htm ├── ControlFocus.htm ├── ControlGetChecked.htm ├── ControlGetChoice.htm ├── ControlGetClassNN.htm ├── ControlGetEnabled.htm ├── ControlGetFocus.htm ├── ControlGetHwnd.htm ├── ControlGetIndex.htm ├── ControlGetItems.htm ├── ControlGetPos.htm ├── ControlGetStyle.htm ├── ControlGetText.htm ├── ControlGetVisible.htm ├── ControlHide.htm ├── ControlHideDropDown.htm ├── ControlMove.htm ├── ControlSend.htm ├── ControlSetChecked.htm ├── ControlSetEnabled.htm ├── ControlSetStyle.htm ├── ControlSetText.htm ├── ControlShow.htm ├── ControlShowDropDown.htm ├── CoordMode.htm ├── Critical.htm ├── DateAdd.htm ├── DateDiff.htm ├── DetectHiddenText.htm ├── DetectHiddenWindows.htm ├── DirCopy.htm ├── DirCreate.htm ├── DirDelete.htm ├── DirExist.htm ├── DirMove.htm ├── DirSelect.htm ├── DllCall.htm ├── Download.htm ├── Drive.htm ├── DriveEject.htm ├── DriveGetCapacity.htm ├── DriveGetFileSystem.htm ├── DriveGetLabel.htm ├── DriveGetList.htm ├── DriveGetSerial.htm ├── DriveGetSpaceFree.htm ├── DriveGetStatus.htm ├── DriveGetStatusCD.htm ├── DriveGetType.htm ├── DriveLock.htm ├── DriveSetLabel.htm ├── DriveUnlock.htm ├── Edit.htm ├── EditGetCurrentCol.htm ├── EditGetCurrentLine.htm ├── EditGetLine.htm ├── EditGetLineCount.htm ├── EditGetSelectedText.htm ├── EditPaste.htm ├── Else.htm ├── Enumerator.htm ├── EnvGet.htm ├── EnvSet.htm ├── Error.htm ├── Exit.htm ├── ExitApp.htm ├── File.htm ├── FileAppend.htm ├── FileCopy.htm ├── FileCreateShortcut.htm ├── FileDelete.htm ├── FileEncoding.htm ├── FileExist.htm ├── FileGetAttrib.htm ├── FileGetShortcut.htm ├── FileGetSize.htm ├── FileGetTime.htm ├── FileGetVersion.htm ├── FileInstall.htm ├── FileMove.htm ├── FileOpen.htm ├── FileRead.htm ├── FileRecycle.htm ├── FileRecycleEmpty.htm ├── FileSelect.htm ├── FileSetAttrib.htm ├── FileSetTime.htm ├── Finally.htm ├── Float.htm ├── For.htm ├── Format.htm ├── FormatTime.htm ├── Func.htm ├── GetKeyName.htm ├── GetKeySC.htm ├── GetKeyState.htm ├── GetKeyVK.htm ├── GetMethod.htm ├── Goto.htm ├── GroupActivate.htm ├── GroupAdd.htm ├── GroupClose.htm ├── GroupDeactivate.htm ├── Gui.htm ├── GuiControl.htm ├── GuiControls.htm ├── GuiCtrlFromHwnd.htm ├── GuiFromHwnd.htm ├── GuiOnCommand.htm ├── GuiOnEvent.htm ├── GuiOnNotify.htm ├── HasBase.htm ├── HasMethod.htm ├── HasProp.htm ├── HotIf.htm ├── Hotkey.htm ├── Hotstring.htm ├── If.htm ├── ImageSearch.htm ├── InStr.htm ├── IniDelete.htm ├── IniRead.htm ├── IniWrite.htm ├── InputBox.htm ├── InputHook.htm ├── InstallKeybdHook.htm ├── InstallMouseHook.htm ├── Integer.htm ├── Is.htm ├── IsLabel.htm ├── IsObject.htm ├── IsSet.htm ├── KeyHistory.htm ├── KeyWait.htm ├── ListHotkeys.htm ├── ListLines.htm ├── ListVars.htm ├── ListView.htm ├── ListViewGetContent.htm ├── LoadPicture.htm ├── Loop.htm ├── LoopFiles.htm ├── LoopParse.htm ├── LoopRead.htm ├── LoopReg.htm ├── Map.htm ├── Math.htm ├── Menu.htm ├── MenuFromHandle.htm ├── MenuSelect.htm ├── Monitor.htm ├── MonitorGet.htm ├── MonitorGetCount.htm ├── MonitorGetName.htm ├── MonitorGetPrimary.htm ├── MonitorGetWorkArea.htm ├── MouseClick.htm ├── MouseClickDrag.htm ├── MouseGetPos.htm ├── MouseMove.htm ├── MsgBox.htm ├── NumGet.htm ├── NumPut.htm ├── Number.htm ├── ObjAddRef.htm ├── ObjBindMethod.htm ├── Object.htm ├── OnClipboardChange.htm ├── OnError.htm ├── OnExit.htm ├── OnMessage.htm ├── Ord.htm ├── OutputDebug.htm ├── Pause.htm ├── Persistent.htm ├── PixelGetColor.htm ├── PixelSearch.htm ├── PostMessage.htm ├── Process.htm ├── ProcessClose.htm ├── ProcessExist.htm ├── ProcessGetName.htm ├── ProcessGetParent.htm ├── ProcessSetPriority.htm ├── ProcessWait.htm ├── ProcessWaitClose.htm ├── Random.htm ├── RegCreateKey.htm ├── RegDelete.htm ├── RegDeleteKey.htm ├── RegExMatch.htm ├── RegExReplace.htm ├── RegRead.htm ├── RegWrite.htm ├── Reload.htm ├── Return.htm ├── Run.htm ├── RunAs.htm ├── Send.htm ├── SendLevel.htm ├── SendMessage.htm ├── SendMode.htm ├── SetControlDelay.htm ├── SetDefaultMouseSpeed.htm ├── SetKeyDelay.htm ├── SetMouseDelay.htm ├── SetNumScrollCapsLockState.htm ├── SetRegView.htm ├── SetStoreCapsLockMode.htm ├── SetTimer.htm ├── SetTitleMatchMode.htm ├── SetWinDelay.htm ├── SetWorkingDir.htm ├── Shutdown.htm ├── Sleep.htm ├── Sort.htm ├── Sound.htm ├── SoundBeep.htm ├── SoundGetInterface.htm ├── SoundGetMute.htm ├── SoundGetName.htm ├── SoundGetVolume.htm ├── SoundPlay.htm ├── SoundSetMute.htm ├── SoundSetVolume.htm ├── SplitPath.htm ├── StatusBarGetText.htm ├── StatusBarWait.htm ├── StrCompare.htm ├── StrGet.htm ├── StrLen.htm ├── StrLower.htm ├── StrPtr.htm ├── StrPut.htm ├── StrReplace.htm ├── StrSplit.htm ├── String.htm ├── SubStr.htm ├── Suspend.htm ├── Switch.htm ├── SysGet.htm ├── SysGetIPAddresses.htm ├── Thread.htm ├── Throw.htm ├── ToolTip.htm ├── TraySetIcon.htm ├── TrayTip.htm ├── TreeView.htm ├── Trim.htm ├── Try.htm ├── Type.htm ├── Until.htm ├── VarSetStrCapacity.htm ├── VerCompare.htm ├── While.htm ├── Win.htm ├── WinActivate.htm ├── WinActivateBottom.htm ├── WinActive.htm ├── WinClose.htm ├── WinExist.htm ├── WinGetClass.htm ├── WinGetClientPos.htm ├── WinGetControls.htm ├── WinGetControlsHwnd.htm ├── WinGetCount.htm ├── WinGetID.htm ├── WinGetIDLast.htm ├── WinGetList.htm ├── WinGetMinMax.htm ├── WinGetPID.htm ├── WinGetPos.htm ├── WinGetProcessName.htm ├── WinGetProcessPath.htm ├── WinGetStyle.htm ├── WinGetText.htm ├── WinGetTitle.htm ├── WinGetTransColor.htm ├── WinGetTransparent.htm ├── WinHide.htm ├── WinKill.htm ├── WinMaximize.htm ├── WinMinimize.htm ├── WinMinimizeAll.htm ├── WinMove.htm ├── WinMoveBottom.htm ├── WinMoveTop.htm ├── WinRedraw.htm ├── WinRestore.htm ├── WinSetAlwaysOnTop.htm ├── WinSetEnabled.htm ├── WinSetRegion.htm ├── WinSetStyle.htm ├── WinSetTitle.htm ├── WinSetTransColor.htm ├── WinSetTransparent.htm ├── WinShow.htm ├── WinWait.htm ├── WinWaitActive.htm ├── WinWaitClose.htm ├── _ClipboardTimeout.htm ├── _DllLoad.htm ├── _ErrorStdOut.htm ├── _HotIf.htm ├── _HotIfTimeout.htm ├── _Hotstring.htm ├── _Include.htm ├── _InputLevel.htm ├── _MaxThreads.htm ├── _MaxThreadsBuffer.htm ├── _MaxThreadsPerHotkey.htm ├── _NoTrayIcon.htm ├── _Requires.htm ├── _SingleInstance.htm ├── _SuspendExempt.htm ├── _UseHook.htm ├── _Warn.htm ├── _WinActivateForce.htm └── index.htm ├── license.htm ├── misc ├── Acknowledgements.htm ├── Ahk2ExeDirectives.htm ├── CLSID-List.htm ├── Colors.htm ├── DPIScaling.htm ├── Editors.htm ├── EscapeChar.htm ├── FontsStandard.htm ├── Functor.htm ├── ImageHandles.htm ├── Labels.htm ├── Languages.htm ├── LongPaths.htm ├── Macros.htm ├── Override.htm ├── Performance.htm ├── RegEx-QuickRef.htm ├── RegExCallout.htm ├── Remap.htm ├── RemapController.htm ├── SendMessage.htm ├── SendMessageList.htm ├── Styles.htm ├── Threads.htm ├── WinTitle.htm ├── Winamp.htm └── remove-userchoice.reg ├── scripts ├── ContextSensitiveHelp.ahk ├── ControllerMouse.ahk ├── ControllerTest.ahk ├── EasyWindowDrag.ahk ├── EasyWindowDrag_(KDE).ahk ├── EncodeHTML.ahk ├── FavoriteFolders.ahk ├── KeyboardOnScreen.ahk ├── MinimizeToTrayMenu.ahk ├── MsgBoxButtonNames.ahk ├── Numpad000.ahk ├── NumpadMouse.ahk ├── Seek_(SearchTheStartMenu).ahk ├── TooltipMouseMenu.ahk ├── UpDownCustomIncrements.ahk ├── VolumeOSD.ahk ├── WinLIRC.ahk ├── WindowShading.ahk └── index.htm ├── search.htm ├── settings.htm ├── static ├── ahk16.png ├── ahk16_pause.png ├── ahk16_pause_suspend.png ├── ahk16_suspend.png ├── ahk_logo.png ├── ahk_logo.svg ├── ahk_logo_no_text.png ├── ahkfile16.png ├── content.css ├── content.js ├── ctrl_button.png ├── ctrl_check.png ├── ctrl_combo.png ├── ctrl_datetime.png ├── ctrl_ddl.png ├── ctrl_edit.png ├── ctrl_group.png ├── ctrl_hotkey.png ├── ctrl_link.png ├── ctrl_list.png ├── ctrl_listview.png ├── ctrl_menu.png ├── ctrl_monthcal.png ├── ctrl_progress.png ├── ctrl_radio.png ├── ctrl_slider.png ├── ctrl_status.png ├── ctrl_tab.png ├── ctrl_text.png ├── ctrl_treeview.png ├── ctrl_updown.png ├── dark.css ├── dlg_file.png ├── dlg_folder.png ├── dlg_input.png ├── dlg_message.png ├── dlg_tooltip.png ├── dlg_traytip.png ├── fonts │ ├── icons.eot │ ├── icons.svg │ ├── icons.ttf │ └── icons.woff ├── highlighter │ ├── dark.css │ ├── highlighter.css │ ├── highlighter.js │ └── light.css ├── sound_levels.png ├── source │ ├── build_search.ahk │ ├── check_data.ahk │ ├── data_deprecate.js │ ├── data_index.js │ ├── data_search.js │ ├── data_toc.js │ └── data_translate.js └── theme.css ├── v1-changes.htm └── v2-changes.htm /docs/404.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

404 - File not found

15 |

Looks like the document you're looking for doesn't exist.

16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/lib/Break.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Break - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Break

14 |

Exits (terminates) any type of loop statement.

15 |
Break LoopLabel
16 | 17 |

Parameters

18 |
19 |
LoopLabel
20 |
21 |

If omitted or 1, this statement applies to the innermost loop in which it is enclosed. Otherwise, specify which loop this statement should apply to; either by label name or numeric nesting level. If a label is specified, it must point directly at a loop statement.

22 |

LoopLabel must be a constant value - variables and expressions are not supported, with the exception of a single literal number or quoted string enclosed in parentheses. For example: break("outer")

23 |
24 |
25 | 26 |

Remarks

27 |

The use of Break and Continue are encouraged over Goto since they usually make scripts more readable and maintainable.

28 | 29 |

Continue, Loop, While-loop, For-loop, Blocks, Labels

30 | 31 |

Examples

32 |
33 |

Breaks the loop if var is greater than 25.

34 |
Loop
35 | {
36 |     ; ...
37 |     if (var > 25)
38 |         break
39 |     ; ...
40 |     if (var <= 5)
41 |         continue
42 | }
43 |
44 | 45 |
46 |

Breaks the outer loop from within a nested loop.

47 |
outer:
48 | Loop 3
49 | {
50 |     x := A_Index
51 |     Loop 3
52 |     {
53 |         if (x*A_Index = 6)
54 |             break outer  ; Equivalent to break 2 or goto break_outer.
55 |         MsgBox x "," A_Index
56 |     }
57 | }
58 | break_outer: ; For goto.
59 | 
60 |
61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /docs/lib/CaretGetPos.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CaretGetPos - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

CaretGetPos

15 | 16 |

Retrieves the current position of the caret (text insertion point).

17 | 18 |
CaretFound := CaretGetPos(&OutputVarX, &OutputVarY)
19 |

Parameters

20 |
21 |
&OutputVarX, &OutputVarY
22 |
23 |

Type: VarRef

24 |

If omitted, the corresponding value will not be stored. Otherwise, specify references to the output variables in which to store the X and Y coordinates. The retrieved coordinates are relative to the active window's client area unless overridden by using CoordMode or A_CoordModeCaret.

25 |
26 |
27 | 28 |

Return Value

29 |

Type: Integer (boolean)

30 |

If there is no active window or the caret position cannot be determined, the function returns 0 (false) and the output variables are made blank. The function returns 1 (true) if the system returned a caret position, but this does not necessarily mean a caret is visible.

31 | 32 |

Remarks

33 |

Any of the output variables may be omitted if the corresponding information is not needed.

34 |

Note that some windows (e.g. certain versions of MS Word) report the same caret position regardless of its actual position.

35 | 36 | 37 |

CoordMode, A_CoordModeCaret

38 | 39 |

Examples

40 |
41 |

Allows the user to move the caret around to see its current position displayed in an auto-update tooltip.

42 |
SetTimer WatchCaret, 100
43 | WatchCaret() {
44 |     if CaretGetPos(&x, &y)
45 |         ToolTip "X" x " Y" y, x, y - 20
46 |     else
47 |         ToolTip "No caret"
48 | }
49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/lib/Chr.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Chr - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Chr

14 | 15 |

Returns the string (usually a single character) corresponding to the character code indicated by the specified number.

16 | 17 |
String := Chr(Number)
18 |

Parameters

19 |
20 | 21 |
Number
22 |
23 |

Type: Integer

24 |

A Unicode character code between 0 and 0x10FFFF.

25 |
26 | 27 |
28 | 29 |

Return Value

30 |

Type: String

31 |

The string corresponding to Number. This is always a single Unicode character, but for practical reasons, Unicode supplementary characters (where Number is in the range 0x10000 to 0x10FFFF) are counted as two characters. That is, the length of the return value as reported by StrLen may be 1 or 2. For further explanation, see String Encoding.

32 |

If Number is 0, the return value is a string containing a binary null character, not an empty (zero-length) string. This can be safely assigned to a variable, passed to a function or concatenated with another string. However, some built-in functions may "see" only the part of the string preceding the first null character.

33 | 34 |

Remarks

35 |

The range and meaning of character codes depends on which string encoding is in use. Currently all AutoHotkey v2 executables are built for Unicode, so this function always accepts a Unicode character code and returns a Unicode (UTF-16) string.

36 |

Common character codes include 9 (tab), 10 (linefeed), 13 (carriage return), 32 (space), 48-57 (the digits 0-9), 65-90 (uppercase A-Z), and 97-122 (lowercase a-z).

37 | 38 | 39 |

Ord

40 | 41 |

Examples

42 |
43 |

Reports the string corresponding to the character code 116.

44 |
MsgBox Chr(116) ; Reports "t".
45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/lib/ComObjActive.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ComObjActive - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

ComObjActive

14 | 15 |

Retrieves a registered COM object.

16 |
ComObj := ComObjActive(CLSID)
17 | 18 |

Parameters

19 |
20 | 21 |
CLSID
22 |
23 |

Type: String

24 |

CLSID or human-readable Prog ID of the COM object to retrieve.

25 |
26 | 27 |
28 | 29 |

Return Value

30 |

Type: ComObject

31 |

This function returns a new COM wrapper object with the variant type VT_DISPATCH (9).

32 | 33 |

Error Handling

34 |

An exception is thrown on failure.

35 | 36 | 37 |

ComValue, ComObject, ComObjGet, ComObjConnect, ComObjFlags, ObjAddRef/ObjRelease, ComObjQuery, GetActiveObject (Microsoft Docs)

38 | 39 |

Examples

40 |
41 |

Displays the active document in Microsoft Word, if it is running. For details about the COM object and its properties used below, see Word.Application object (Microsoft Docs).

42 |
43 | word := ComObjActive("Word.Application")
44 | if !word
45 |     MsgBox "Word isn't open."
46 | else
47 |     MsgBox word.ActiveDocument.FullName
48 |
49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/lib/ComObjFromPtr.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ComObjFromPtr - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

ComObjFromPtr

15 | 16 |

Wraps a raw IDispatch pointer (COM object) for use by the script.

17 |
ComObj := ComObjFromPtr(DispPtr)
18 | 19 |

Parameters

20 |
21 | 22 |
DispPtr
23 |
24 |

Type: Integer

25 |

A non-null interface pointer for IDispatch or a derived interface.

26 |
27 | 28 |
29 | 30 |

Return Value

31 |

Type: ComObject

32 |

Returns a wrapper object containing the variant type VT_DISPATCH and the given pointer.

33 |

Wrapping a COM object enables the script to interact with it more naturally, using object syntax. However, the majority of scripts do not need to do this manually since a wrapper object is created automatically by ComObject, ComObjActive, ComObjGet and any COM method which returns an object.

34 | 35 |

Remarks

36 |

The wrapper object assumes responsibility for automatically releasing the pointer when appropriate. This function queries the object for its IDispatch interface; if one is returned, DispPtr is immediately released. Therefore, if the script intends to use the pointer after calling this function, it must call ObjAddRef(DispPtr) first.

37 |

Known limitation: Each time a COM object is wrapped, a new wrapper object is created. Comparisons and assignments such as obj1 == obj2 and arr[obj1] := value treat the two wrapper objects as unique, even when they contain the same COM object.

38 | 39 | 40 |

ComObject, ComValue, ComObjGet, ComObjConnect, ComObjFlags, ObjAddRef/ObjRelease, ComObjQuery, GetActiveObject (Microsoft Docs)

41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/lib/ComObjGet.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ComObjGet - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

ComObjGet

14 |

Returns a reference to an object provided by a COM component.

15 |
ComObj := ComObjGet(Name)
16 | 17 |

Parameters

18 |
19 | 20 |
Name
21 |
22 |

Type: String

23 |

The display name of the object to be retrieved. See MkParseDisplayName (Microsoft Docs) for more information.

24 |
25 | 26 |
27 | 28 |

Return Value

29 |

Type: ComObject

30 |

This function returns a new COM wrapper object with the variant type VT_DISPATCH (9).

31 | 32 |

Error Handling

33 |

An exception is thrown on failure.

34 | 35 | 36 | ComObject, ComObjActive, ComObjConnect, ComObjQuery, CoGetObject (Microsoft Docs) 37 | 38 |

Examples

39 |
40 |

Press Shift+Esc to show the command line which was used to launch the active window's process. For Win32_Process, see Microsoft Docs.

41 |
+Esc::
42 | {
43 |     pid := WinGetPID("A")
44 |     ; Get WMI service object.
45 |     wmi := ComObjGet("winmgmts:")
46 |     ; Run query to retrieve matching process(es).
47 |     queryEnum := wmi.ExecQuery(""
48 |         . "Select * from Win32_Process where ProcessId=" . pid)
49 |         ._NewEnum()
50 |     ; Get first matching process.
51 |     if queryEnum(&proc)
52 |         MsgBox(proc.CommandLine, "Command line", 0)
53 |     else
54 |         MsgBox("Process not found!")
55 | }
56 |
57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /docs/lib/ComObjValue.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ComObjValue - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

ComObjValue

14 | 15 |

Retrieves the value or pointer stored in a COM wrapper object.

16 | 17 |
Value := ComObjValue(ComObj)
18 | 19 |

Parameters

20 |
21 | 22 |
ComObj
23 |
24 |

Type: Object

25 |

A wrapper object containing a COM object or typed value. See ComValue for details.

26 |
27 | 28 |
29 | 30 |

Return Value

31 |

Type: Integer

32 |

This function returns a 64-bit signed integer.

33 | 34 |

Error Handling

35 |

A TypeError is thrown if ComObj is not a COM wrapper object.

36 | 37 |

Remarks

38 |

This function is not intended for general use.

39 |

Calling ComObjValue is equivalent to variant.llVal, where ComObj is treated as a VARIANT structure. Any script which uses this function must be aware what type of value the wrapper object contains and how it should be treated. For instance, if an interface pointer is returned, Release should not be called, but AddRef may be required depending on what the script does with the pointer.

40 | 41 | 42 |

ComObjType, ComObject, ComObjGet, ComObjActive

43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/lib/DateAdd.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DateAdd - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DateAdd

15 | 16 |

Adds or subtracts time from a date-time value.

17 | 18 |
Result := DateAdd(DateTime, Time, TimeUnits)
19 |

Parameters

20 |
21 | 22 |
DateTime
23 |
24 |

Type: String

25 |

A date-time stamp in the YYYYMMDDHH24MISS format.

26 |
27 | 28 |
Time
29 |
30 |

Type: Integer or Float

31 |

The amount of time to add, as an integer or floating-point number. Specify a negative number to perform subtraction.

32 |
33 | 34 |
TimeUnits
35 |
36 |

Type: String

37 |

The meaning of the Time parameter. TimeUnits may be one of the following strings (or just the first letter): Seconds, Minutes, Hours or Days.

38 | 39 |
40 | 41 |

Return Value

42 |

Type: String

43 |

This function returns a string of digits in the YYYYMMDDHH24MISS format. This string should not be treated as a number, i.e. one should not perform math on it or compare it numerically.

44 | 45 |

Remarks

46 |

The built-in variable A_Now contains the current local time in YYYYMMDDHH24MISS format.

47 |

To calculate the amount of time between two timestamps, use DateDiff.

48 |

If DateTime contains an invalid timestamp or a year prior to 1601, a ValueError is thrown.

49 | 50 | 51 |

DateDiff, FileGetTime, FormatTime

52 | 53 |

Examples

54 |
55 |

Calculates the date 31 days from now and reports the result in human-readable form.

56 |
57 | later := DateAdd(A_Now, 31, "days")
58 | MsgBox FormatTime(later)
59 | 
60 |
61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /docs/lib/DetectHiddenText.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DetectHiddenText - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

DetectHiddenText

14 | 15 |

Determines whether invisible text in a window is "seen" for the purpose of finding the window. This affects windowing functions such as WinExist and WinActivate.

16 | 17 |
DetectHiddenText Mode
18 |

Parameters

19 |
20 | 21 |
Mode
22 |
23 |

Type: Boolean

24 |

If true, hidden text is detected.

25 |

If false, hidden text is not detected.

26 |
27 | 28 |
29 | 30 |

Return Value

31 |

Type: Integer (boolean)

32 |

This function returns the previous setting; either 0 (false) or 1 (true).

33 | 34 |

Remarks

35 |

If DetectHiddenText is not used, the default setting is 1 (true).

36 |

"Hidden text" is a term that refers to those controls of a window that are not visible. Their text is thus considered "hidden". Turning off DetectHiddenText can be useful in cases where you want to detect the difference between the different panes of a multi-pane window or multi-tabbed dialog. Use Window Spy to determine which text of the currently-active window is hidden. All built-in functions that accept a WinText parameter are affected by this setting, including WinActivate, WinActive, WinWait, and WinExist.

37 |

The built-in variable A_DetectHiddenText contains the current setting (1 or 0).

38 |

Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this function. That default may be changed by using this function during script startup.

39 | 40 |

DetectHiddenWindows

41 |

Examples

42 |
43 |

Turns off the detection of hidden text.

44 |
DetectHiddenText false
45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/lib/DirCreate.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DirCreate - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DirCreate

15 | 16 |

Creates a folder.

17 | 18 |
DirCreate DirName
19 |

Parameters

20 |
21 | 22 |
DirName
23 |
24 |

Type: String

25 |

Name of the directory to create, which is assumed to be in A_WorkingDir if an absolute path isn't specified.

26 |
27 | 28 |
29 | 30 |

Error Handling

31 |

An OSError is thrown if an error occurs.

32 |

A_LastError is set to the result of the operating system's GetLastError() function.

33 | 34 |

Remarks

35 |

This function will also create all parent directories given in DirName if they do not already exist.

36 | 37 |

DirDelete

38 |

Examples

39 |
40 |

Creates a new directory, including its parent directories if necessary.

41 |
DirCreate "C:\Test1\My Images\Folder2"
42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/lib/DirDelete.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DirDelete - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DirDelete

15 | 16 |

Deletes a folder.

17 | 18 |
DirDelete DirName , Recurse
19 |

Parameters

20 |
21 | 22 |
DirName
23 |
24 |

Type: String

25 |

Name of the directory to delete, which is assumed to be in A_WorkingDir if an absolute path isn't specified.

26 |
27 | 28 |
Recurse
29 |
30 |

Type: Boolean

31 |

If omitted, it defaults to false.

32 |

If false, files and subdirectories contained in DirName are not removed. In this case, if DirName is not empty, no action is taken and an exception is thrown.

33 |

If true, all files and subdirectories are removed (like the Windows command "rmdir /S").

34 |
35 | 36 |
37 | 38 |

Error Handling

39 |

An exception is thrown if an error occurs.

40 | 41 | 42 |

DirCreate, FileDelete

43 |

Examples

44 |
45 |

Removes the directory, but only if it is empty.

46 |
DirDelete "C:\Download Temp"
47 |
48 | 49 |
50 |

Removes the directory including its files and subdirectories.

51 |
DirDelete "C:\Download Temp", true
52 |
53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /docs/lib/DriveGetCapacity.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveGetCapacity - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveGetCapacity

15 | 16 |

Returns the total capacity of the drive which contains the specified path, in megabytes.

17 | 18 |
Capacity := DriveGetCapacity(Path)
19 | 20 |

Parameters

21 |
22 |
Path
23 |
24 |

Type: String

25 |

Any path contained by the drive (might also work on UNC paths and mapped drives).

26 |
27 |
28 | 29 |

Return Value

30 |

Type: Integer

31 |

This function returns the total capacity of the drive which contains Path, in megabytes.

32 | 33 |

Error Handling

34 |

An exception is thrown on failure.

35 | 36 |

Remarks

37 |

In general, Path can be any path. Since NTFS supports mounted volumes and directory junctions, different paths with the same drive letter can produce different amounts of capacity.

38 | 39 | 40 |

DriveGetSpaceFree, Drive functions

41 | 42 |

Examples

43 |

See example #1 on the Drive Functions page for a demonstration of this function.

44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/lib/DriveGetFileSystem.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveGetFileSystem - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveGetFileSystem

15 | 16 |

Returns the type of the specified drive's file system.

17 | 18 |
FileSystem := DriveGetFileSystem(Drive)
19 | 20 |

Parameters

21 |
22 |
Drive
23 |
24 |

Type: String

25 |

The drive letter followed by a colon and an optional backslash, or a UNC name such as "\server1\share1".

26 |
27 |
28 | 29 |

Return Value

30 |

Type: String

31 |

This function returns the type of Drive's file system. The possible values are defined by the system; they include (but are not limited to) the following: NTFS, FAT32, FAT, CDFS (typically indicates a CD), or UDF (typically indicates a DVD).

32 | 33 |

Error Handling

34 |

An exception is thrown on failure, such as if the drive does not contain formatted media.

35 | 36 | 37 |

Drive functions

38 | 39 |

Examples

40 |

See example #1 on the Drive Functions page for a demonstration of this function.

41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/lib/DriveGetLabel.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveGetLabel - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveGetLabel

15 | 16 |

Returns the volume label of the specified drive.

17 | 18 |
Label := DriveGetLabel(Drive)
19 | 20 |

Parameters

21 |
22 |
Drive
23 |
24 |

Type: String

25 |

The drive letter followed by a colon and an optional backslash, or a UNC name such as "\server1\share1".

26 |
27 |
28 | 29 |

Return Value

30 |

Type: String

31 |

This function returns the Drive's volume label.

32 | 33 |

Error Handling

34 |

An exception is thrown on failure.

35 | 36 | 37 |

DriveSetLabel, Drive functions

38 | 39 |

Examples

40 |

See example #1 on the Drive Functions page for a demonstration of this function.

41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/lib/DriveGetList.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveGetList - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveGetList

15 | 16 |

Returns a string of letters, one character for each drive letter in the system.

17 | 18 |
List := DriveGetList(DriveType)
19 | 20 |

Parameters

21 |
22 |
DriveType
23 |
24 |

Type: String

25 |

If omitted, all drive types are retrieved. Otherwise, specify one of the following words to retrieve only a specific type of drive: CDROM, REMOVABLE, FIXED, NETWORK, RAMDISK, UNKNOWN.

26 |
27 |
28 | 29 |

Return Value

30 |

Type: String

31 |

This function returns the drive letters in the system, depending on DriveType. For example: ACDEZ.

32 | 33 | 34 |

Drive functions

35 | 36 |

Examples

37 |

See example #1 on the Drive Functions page for a demonstration of this function.

38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /docs/lib/DriveGetSerial.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveGetSerial - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveGetSerial

15 | 16 |

Returns the volume serial number of the specified drive.

17 | 18 |
Serial := DriveGetSerial(Drive)
19 | 20 |

Parameters

21 |
22 |
Drive
23 |
24 |

Type: String

25 |

The drive letter followed by a colon and an optional backslash, or a UNC name such as "\server1\share1".

26 |
27 |
28 | 29 |

Return Value

30 |

Type: Integer

31 |

This function returns the Drive's volume serial number. See Format for how to convert it to hexadecimal.

32 | 33 |

Error Handling

34 |

An exception is thrown on failure.

35 | 36 | 37 |

Drive functions

38 | 39 |

Examples

40 |

See example #1 on the Drive Functions page for a demonstration of this function.

41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/lib/DriveGetSpaceFree.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveGetSpaceFree - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveGetSpaceFree

15 | 16 |

Returns the free disk space of the drive which contains the specified path, in megabytes.

17 | 18 |
FreeSpace := DriveGetSpaceFree(Path)
19 | 20 |

Parameters

21 |
22 |
Path
23 |
24 |

Type: String

25 |

Any path contained by the drive (might also work on UNC paths and mapped drives).

26 |
27 |
28 | 29 |

Return Value

30 |

Type: Integer

31 |

This function returns the free disk space of the drive which contains Path, in megabytes (rounded down to the nearest megabyte).

32 | 33 |

Error Handling

34 |

An exception is thrown on failure.

35 | 36 |

Remarks

37 |

In general, Path can be any path. Since NTFS supports mounted volumes and directory junctions, different paths with the same drive letter can produce different amounts of free space.

38 | 39 | 40 |

DriveGetCapacity, Drive functions

41 | 42 |

Examples

43 |
44 |

Retrieves and reports the free disk space of the drive which contains A_MyDocuments.

45 |
FreeSpace := DriveGetSpaceFree(A_MyDocuments)
46 | MsgBox FreeSpace " MB"
47 |
48 |

See example #1 on the Drive Functions page for another demonstration of this function.

49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/lib/DriveGetStatus.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveGetStatus - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveGetStatus

15 | 16 |

Returns the status of the drive which contains the specified path.

17 | 18 |
Status := DriveGetStatus(Path)
19 | 20 |

Parameters

21 |
22 |
Path
23 |
24 |

Type: String

25 |

Any path contained by the drive (might also work on UNC paths and mapped drives).

26 |
27 |
28 | 29 |

Return Value

30 |

Type: String

31 |

This function returns the status of the drive which contains Path:

32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
StatusNotes
UnknownMight indicate unformatted/RAW file system.
ReadyThis is the most common.
NotReadyTypical for removable drives that don't contain media.
InvalidPath does not exist or is a network drive that is presently inaccessible, etc.
54 | 55 |

Error Handling

56 |

An exception is thrown on failure.

57 | 58 |

Remarks

59 |

In general, Path can be any path. Since NTFS supports mounted volumes and directory junctions, different paths with the same drive letter can produce different results.

60 | 61 | 62 |

Drive functions

63 | 64 |

Examples

65 |

See example #1 on the Drive Functions page for a demonstration of this function.

66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /docs/lib/DriveGetStatusCD.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveGetStatusCD - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveGetStatusCD

15 | 16 |

Returns the media status of the specified CD/DVD drive.

17 | 18 |
CDStatus := DriveGetStatusCD(Drive)
19 | 20 |

Parameters

21 |
22 |
Drive
23 |
24 |

Type: String

25 |

If omitted, the default CD/DVD drive will be used. Otherwise, specify the drive letter followed by a colon.

26 |
27 |
28 | 29 |

Return Value

30 |

Type: String

31 |

This function returns the Drive's media status:

32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
StatusMeaning
not readyThe drive is not ready to be accessed, perhaps due to being engaged in a write operation. Known limitation: "not ready" also occurs when the drive contains a DVD rather than a CD.
openThe drive contains no disc, or the tray is ejected.
playingThe drive is playing a disc.
pausedThe previously playing audio or video is now paused.
seekingThe drive is seeking.
stoppedThe drive contains a CD but is not currently accessing it.
62 | 63 |

Error Handling

64 |

An exception is thrown on failure.

65 | 66 |

Remarks

67 |

This function will probably not work on a network drive or non-CD/DVD drive. If it fails in such cases or for any other reason, an exception is thrown.

68 |

If the tray was recently closed, there may be a delay before the function completes.

69 | 70 | 71 |

DriveEject, Drive functions

72 | 73 |

Examples

74 |

See example #1 on the Drive Functions page for a demonstration of this function.

75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /docs/lib/DriveGetType.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveGetType - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveGetType

15 | 16 |

Returns the type of the drive which contains the specified path.

17 | 18 |
DriveType := DriveGetType(Path)
19 | 20 |

Parameters

21 |
22 |
Path
23 |
24 |

Type: String

25 |

Any path contained by the drive (might also work on UNC paths and mapped drives).

26 |
27 |
28 | 29 |

Return Value

30 |

Type: String

31 |

This function returns the type of the drive which contains Path: Unknown, Removable, Fixed, Network, CDROM, or RAMDisk. If Path is invalid (e.g. because the drive does not exist), the return value is an empty string.

32 | 33 |

Remarks

34 |

In general, Path can be any path. Since NTFS supports mounted volumes and directory junctions, different paths with the same drive letter can produce different results.

35 | 36 | 37 |

Drive functions

38 | 39 |

Examples

40 |

See example #1 on the Drive Functions page for a demonstration of this function.

41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/lib/DriveLock.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveLock - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveLock

15 | 16 |

Prevents the eject feature of the specified drive from working.

17 | 18 |
DriveLock Drive
19 | 20 |

Parameters

21 |
22 |
Drive
23 |
24 |

Type: String

25 |

The drive letter followed by a colon and an optional backslash (might also work on UNC paths and mapped drives).

26 |
27 |
28 | 29 |

Error Handling

30 |

An exception is thrown on failure, such as if Drive does not exist or does not support the locking feature.

31 | 32 |

Remarks

33 |

Most drives cannot be "locked open". However, locking the drive while it is open will probably result in it becoming locked the moment it is closed.

34 |

This function has no effect on drives that do not support locking (such as most read-only drives).

35 |

To unlock a drive, call DriveUnlock. If a drive is locked by a script and that script exits, the drive will stay locked until another script or program unlocks it, or the system is restarted.

36 | 37 | 38 |

DriveUnlock, Drive functions

39 | 40 |

Examples

41 |
42 |

Locks the D drive.

43 |
DriveLock "D:"
44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /docs/lib/DriveSetLabel.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveSetLabel - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveSetLabel

15 | 16 |

Changes the volume label of the specified drive.

17 | 18 |
DriveSetLabel Drive , NewLabel
19 | 20 |

Parameters

21 |
22 |
Drive
23 |
24 |

Type: String

25 |

The drive letter followed by a colon and an optional backslash (might also work on UNC paths and mapped drives).

26 |
27 |
NewLabel
28 |
29 |

Type: String

30 |

If omitted, the drive will have no label. Otherwise, specify the new label to set.

31 |
32 |
33 | 34 |

Error Handling

35 |

An exception is thrown on failure.

36 | 37 | 38 |

DriveGetLabel, Drive functions

39 | 40 |

Examples

41 |
42 |

Changes the volume label of the C drive.

43 |
DriveSetLabel "C:", "Seagate200"
44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /docs/lib/DriveUnlock.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveUnlock - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveUnlock

15 | 16 |

Restores the eject feature of the specified drive.

17 | 18 |
DriveUnlock Drive
19 | 20 |

Parameters

21 |
22 |
Drive
23 |
24 |

Type: String

25 |

The drive letter followed by a colon and an optional backslash (might also work on UNC paths and mapped drives).

26 |
27 |
28 | 29 |

Error Handling

30 |

An exception is thrown on failure.

31 | 32 |

Remarks

33 |

This function needs to be called multiple times if the drive was locked multiple times (at least for some drives). For example, if DriveLock("D:") was called three times, DriveUnlock("D:") might need to be called three times to unlock it. Because of this and the fact that there is no way to determine whether a drive is currently locked, it is often useful to keep track of its lock-state in a variable.

34 | 35 | 36 |

DriveLock, Drive functions

37 | 38 |

Examples

39 |
40 |

Unlocks the D drive.

41 |
DriveUnlock "D:"
42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/lib/Edit.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Edit - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Edit

14 | 15 |

Opens the current script for editing in the default editor.

16 | 17 |
Edit
18 |

The Edit function opens the current script for editing using the associated "edit" verb in the registry (or Notepad if no verb). However, if an editor window appears to have the script already open (based on its window title), that window is activated instead of opening a new instance of the editor.

19 |

The default program, script or command line executed by the "edit" verb can be changed via Editor settings in the Dash.

20 |

This function has no effect when operating from within a compiled script.

21 |

On a related note, AutoHotkey syntax highlighting can be enabled for various editors. In addition, context sensitive help for AutoHotkey functions can be enabled in any editor via this example. Finally, your productivity may be improved by using an auto-completion utility like the script by boiler or the script by Helgef, which works in almost any editor. It watches what you type and displays menus and parameter lists, which does some of the typing for you and reminds you of the order of parameters.

22 | 23 | 24 |

Reload, How to edit a script, Editors with AutoHotkey support

25 | 26 |

Examples

27 |
28 |

Opens the script for editing.

29 |
Edit
30 |
31 | 32 |
33 |

If your editor's command-line usage is something like Editor.exe "Full path of script.ahk", the following can be used to set it as the default editor for ahk files. When you run the script, it will prompt you to select the executable file of your editor.

34 |
Editor := FileSelect(2,, "Select your editor", "Programs (*.exe)")
35 | if Editor = ""
36 |     ExitApp
37 | RegWrite Format('"{1}" "%L"', Editor), "REG_SZ", "HKCR\AutoHotkeyScript\Shell\Edit\Command"
38 |
39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/lib/EnvGet.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | EnvGet - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

EnvGet

14 | 15 |

Retrieves the value of the specified environment variable.

16 | 17 |
Value := EnvGet(EnvVar)
18 |

Parameters

19 |
20 | 21 |
EnvVar
22 |
23 |

Type: String

24 |

The name of the environment variable, e.g. "Path".

25 |
26 | 27 |
28 | 29 |

Return Value

30 |

Type: String

31 |

This function returns EnvVar's value. If EnvVar has an empty value or does not exist, an empty string is returned.

32 | 33 |

Remarks

34 |

The operating system limits each environment variable to 32 KB of text.

35 |

This function exists because normal script variables are not stored in the environment. This is because performance would be worse and also because the OS limits environment variables to 32 KB.

36 | 37 |

EnvSet, Run / RunWait

38 |

Examples

39 |
40 |

Retrieves the value of an environment variable and stores it in LogonServer.

41 |
LogonServer := EnvGet("LogonServer")
42 |
43 | 44 |
45 |

Retrieves and reports the path of the "Program Files" directory. See RegRead example #2 for an alternative method.

46 |
ProgramFilesDir := EnvGet(A_Is64bitOS ? "ProgramW6432" : "ProgramFiles")
47 | MsgBox "Program files are in: " ProgramFilesDir
48 |
49 | 50 |
51 |

Retrieves and reports the path of the current user's Local AppData directory.

52 |
LocalAppData := EnvGet("LocalAppData")
53 | MsgBox A_UserName "'s Local directory is located at: " LocalAppData
54 |
55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /docs/lib/EnvSet.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | EnvSet - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

EnvSet

14 | 15 |

Writes a value to the specified environment variable.

16 | 17 |
EnvSet EnvVar , Value
18 |

Parameters

19 |
20 | 21 |
EnvVar
22 |
23 |

Type: String

24 |

The name of the environment variable, e.g. "Path".

25 |
26 | 27 |
Value
28 |
29 |

Type: String

30 |

If omitted, the environment variable will be deleted. Otherwise, specify the value to write.

31 |
32 | 33 |
34 | 35 |

Error Handling

36 |

An OSError is thrown on failure.

37 | 38 |

Remarks

39 |

The operating system limits each environment variable to 32 KB of text.

40 |

An environment variable created or changed with this function will be accessible only to programs the script launches via Run or RunWait. See environment variables for more details.

41 |

This function exists because normal script variables are not stored in the environment. This is because performance would be worse and also because the OS limits environment variables to 32 KB.

42 | 43 |

EnvGet, Run / RunWait

44 |

Examples

45 |
46 |

Writes some text to an environment variable.

47 |
EnvSet "AutGUI", "Some text to put in the environment variable."
48 |
49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/lib/Exit.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exit - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Exit

14 | 15 |

Exits the current thread.

16 | 17 |
Exit ExitCode
18 |

Parameters

19 |
20 | 21 |
ExitCode
22 |
23 |

Type: Integer

24 |

If omitted, it defaults to 0 (zero is traditionally used to indicate success). Otherwise, specify an integer between -2147483648 and 2147483647 that is returned to its caller when the script exits. This code is accessible to any program that spawned the script, such as another script (via RunWait) or a batch (.bat) file.

25 |
26 | 27 |
28 | 29 |

Remarks

30 |

The Exit function terminates only the current thread. In other words, the stack of functions called directly or indirectly by a menu, timer, or hotkey function will all be returned from as though a Return were immediately encountered in each. If used directly inside such a function -- or in global code -- Exit is equivalent to Return.

31 |

If the script is not persistent and this is the last thread, the script will terminate after the thread exits.

32 | 33 |

Use ExitApp to completely terminate a script that is persistent.

34 | 35 | 36 |

ExitApp, OnExit, Functions, Return, Threads, Persistent

37 |

Examples

38 |
39 |

In this example, the Exit function terminates the call_exit function as well as the calling function.

40 |
41 | #z::
42 | {
43 |     call_exit
44 |     MsgBox "This MsgBox will never happen because of the Exit."
45 |     call_exit() 
46 |     {
47 |         Exit ; Terminate this function as well as the calling function.
48 |     }
49 | }
50 | 
51 |
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/lib/ExitApp.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ExitApp - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

ExitApp

14 | 15 |

Terminates the script.

16 | 17 |
ExitApp ExitCode
18 |

Parameters

19 |
20 | 21 |
ExitCode
22 |
23 |

Type: Integer

24 |

If omitted, it defaults to 0 (zero is traditionally used to indicate success). Otherwise, specify an integer between -2147483648 and 2147483647 that is returned to its caller when the script exits. This code is accessible to any program that spawned the script, such as another script (via RunWait) or a batch (.bat) file.

25 |
26 | 27 |
28 | 29 |

Remarks

30 |

This is equivalent to choosing "Exit" from the script's tray menu or main menu.

31 |

Any functions registered by OnExit are called before the script terminates. If such a function returns a non-zero integer, the script does not terminate; instead, the current thread exits as if Exit was called.

32 |

Terminating the script is not the same as exiting each thread. For instance, Finally blocks are not executed and __Delete is not called for objects contained by local variables.

33 |

ExitApp is often unnecessary in scripts which are not persistent.

34 | 35 | 36 |

Exit, OnExit, Persistent

37 | 38 |

Examples

39 |
40 |

Press a hotkey to terminate the script.

41 |
#x::ExitApp  ; Win+X
42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/lib/FileGetVersion.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FileGetVersion - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

FileGetVersion

14 | 15 |

Retrieves the version of a file.

16 | 17 |
Version := FileGetVersion(Filename)
18 |

Parameters

19 |
20 | 21 |
Filename
22 |
23 |

Type: String

24 |

If omitted, the current file of the innermost enclosing file loop will be used. Otherwise, specify the name of the target file. If a full path is not specified, this function uses the search sequence specified by the system LoadLibrary function.

25 |
26 | 27 |
28 | 29 |

Return Value

30 |

Type: String

31 |

This function returns the version number of the specified file.

32 | 33 |

Error Handling

34 |

An OSError is thrown on failure, such as if the file lacks version information.

35 |

A_LastError is set to the result of the operating system's GetLastError() function.

36 | 37 |

Remarks

38 |

Most non-executable files (and even some EXEs) have no version, and thus an error will be thrown.

39 | 40 | 41 |

FileGetAttrib, FileSetAttrib, FileGetTime, FileSetTime, FileGetSize, file loop

42 |

Examples

43 |
44 |

Retrieves the version of a file and stores it in Version.

45 |
Version := FileGetVersion("C:\My Application.exe")
46 |
47 | 48 |
49 |

Retrieves the version of the file "AutoHotkey.exe" located in AutoHotkey's installation directory and stores it in Version.

50 |
Version := FileGetVersion(A_ProgramFiles "\AutoHotkey\AutoHotkey.exe")
51 |
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/lib/FileRecycle.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FileRecycle - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

FileRecycle

14 | 15 |

Sends a file or directory to the recycle bin if possible, or permanently deletes it.

16 | 17 |
FileRecycle FilePattern
18 |

Parameters

19 |
20 | 21 |
FilePattern
22 |
23 |

Type: String

24 |

The name of a single file or a wildcard pattern such as "C:\Temp\*.tmp". FilePattern is assumed to be in A_WorkingDir if an absolute path isn't specified.

25 |

Both asterisks (*) and question marks (?) are supported as wildcards. * matches zero or more characters and ? matches any single character. Usage examples:

26 | 33 |

To recycle an entire directory, provide its name without a trailing backslash.

34 |
35 | 36 |
37 | 38 |

Error Handling

39 |

An exception is thrown on failure.

40 | 41 |

Remarks

42 |

SHFileOperation is used to do the actual work. This function may permanently delete the file if it is too large to be recycled; also, a warning should be shown before this occurs.

43 |

The file may be permanently deleted without warning if the file cannot be recycled for other reasons, such as:

44 | 48 | 49 |

FileRecycleEmpty, FileDelete, FileCopy, FileMove

50 |

Examples

51 |
52 |

Sends all .tmp files in a directory to the recycle bin if possible.

53 |
FileRecycle "C:\temp files\*.tmp"
54 |
55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /docs/lib/FileRecycleEmpty.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FileRecycleEmpty - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

FileRecycleEmpty

14 | 15 |

Empties the recycle bin.

16 | 17 |
FileRecycleEmpty DriveLetter
18 |

Parameters

19 |
20 | 21 |
DriveLetter
22 |
23 |

Type: String

24 |

If omitted, the recycle bin for all drives is emptied. Otherwise, specify a drive letter such as "C:\".

25 |
26 | 27 |
28 | 29 |

Error Handling

30 |

An OSError is thrown on failure.

31 | 32 | 33 |

FileRecycle, FileDelete, FileCopy, FileMove

34 |

Examples

35 |
36 |

Empties the recycle bin of the C drive.

37 |
FileRecycleEmpty "C:\"
38 |
39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/lib/Float.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Float - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Float

15 |

Converts a numeric string or integer value to a floating-point number.

16 |
FltValue := Float(Value)
17 | 18 |

Return Value

19 |

Type: Float

20 |

This function returns the result of converting Value to a pure floating-point number (having the type name "Float"), or Value itself if it is already the correct type.

21 | 22 |

Remarks

23 |

If the value cannot be converted, a TypeError is thrown.

24 |

To determine if a value can be converted to a floating-point number, use the IsNumber function.

25 |

Float is actually a class, but can be called as a function. Value is Float can be used to check whether a value is a pure floating-point number.

26 | 27 | 28 |

Type, Integer, Number, String, Values, Expressions, Is functions

29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/lib/GetKeyName.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GetKeyName - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

GetKeyName

15 | 16 |

Retrieves the name/text of a key.

17 | 18 |
Name := GetKeyName(KeyName)
19 |

Parameters

20 |
21 | 22 |
KeyName
23 |
24 |

Type: String

25 |

This can be just about any single character from the keyboard or one of the key names from the key list. Examples: B, 5, LWin, RControl, Alt, Enter, Escape.

26 |

Alternatively, this can be an explicit virtual key code such as vkFF, an explicit scan code such as sc01D, or a combination of VK and SC (in that order) such as vk1Bsc001. Note that these codes must be in hexadecimal.

27 |
28 | 29 |
30 | 31 |

Return Value

32 |

Type: String

33 |

This function returns the name of the specified key, or blank if the key is invalid or unnamed.

34 | 35 | 36 |

GetKeyVK, GetKeySC, GetKeyState, Key List

37 |

Examples

38 |
39 |

Retrieves and reports the English name of Esc.

40 |
MsgBox GetKeyName("Esc") ; Shows Escape
41 | MsgBox GetKeyName("vk1B") ; Shows also Escape
42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/lib/Goto.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Goto - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Goto

14 | 15 |

Jumps to the specified label and continues execution.

16 | 17 |
Goto Label
18 | Goto("Label")
19 |

Parameters

20 |
21 | 22 |
Label
23 |
24 |

Type: String

25 |

The name of the label to which to jump.

26 |
27 | 28 |
29 | 30 |

Remarks

31 |

Label can be a variable or expression only if parentheses are used. For example, Goto MyLabel and Goto("MyLabel") both jump to MyLabel:.

32 |

Performance is slightly reduced when using a dynamic label (that is, a variable or expression which returns a label name) because the target label must be "looked up" each time rather than only once when the script is first loaded. An error dialog will be displayed if the label does not exist. To avoid this, call IsLabel() beforehand. For example:

33 |
if IsLabel(VarContainingLabelName)
34 |     Goto(VarContainingLabelName)
35 |

The use of Goto is discouraged because it generally makes scripts less readable and harder to maintain. Consider using Else, Blocks, Break, and Continue as substitutes for Goto.

36 | 37 |

Return, IsLabel, Else, Blocks, Break, Continue

38 |

Examples

39 |
40 |

Jumps to the label named "MyLabel" and continues execution.

41 |
Goto MyLabel
42 | ; ...
43 | MyLabel:
44 | Sleep 100
45 | ; ...
46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/lib/GuiCtrlFromHwnd.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GuiCtrlFromHwnd - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

GuiCtrlFromHwnd

15 | 16 |

Retrieves the GuiControl object of a GUI control associated with the specified window handle.

17 |
GuiControlObj := GuiCtrlFromHwnd(Hwnd)
18 | 19 |

Parameters

20 |
21 |
Hwnd
22 |
23 |

Type: Integer

24 |

The window handle (HWND) of a GUI control, or a child window of such a control (e.g. the Edit control of a ComboBox). The control must have been created by the current script via Gui.Add.

25 |
26 |
27 | 28 |

Return Value

29 |

Type: Object or String (empty)

30 |

This function returns the GuiControl object associated with the specified HWND, or an empty string if there isn't one or the HWND is invalid.

31 | 32 |

Remarks

33 |

For example, a HWND of a GUI control can be retrieved via GuiControl.Hwnd, MouseGetPos or OnMessage.

34 | 35 | 36 |

Gui(), Gui object, GuiControl object, GuiFromHwnd, Control Types, ListView, TreeView, Menu object, Control functions, MsgBox, FileSelect, DirSelect

37 | 38 |

Examples

39 |

See the ToolTip example on the Gui object page.

40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/lib/HasBase.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HasBase - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

HasBase

15 | 16 |

Returns a non-zero number if the specified value is derived from the specified base object.

17 | 18 |
HasBase := HasBase(Value, BaseObj)
19 |

Parameters

20 |
21 |
Value
22 |
23 |

Any value, of any type.

24 |
25 |
BaseObj
26 |
27 |

Type: Object

28 |

The potential base object to test.

29 |
30 |
31 | 32 |

Return Value

33 |

Type: Integer (boolean)

34 |

This function returns 1 (true) if BaseObj is in Value's chain of base objects, otherwise 0 (false).

35 | 36 |

Remarks

37 |

The following code is roughly equivalent to this function:

38 |
MyHasBase(Value, BaseObj) {
39 |     b := Value
40 |     while b := ObjGetBase(b)
41 |         if b = BaseObj
42 |             return true
43 |     return false
44 | }
45 |

For example, HasBase(Obj, Array.Prototype) is true if Obj is an instance of Array or any derived class. This the same check performed by Obj is Array; however, instances can be based on other instances, whereas is requires a Class.

46 |

HasBase accepts both objects and primitive values. For example, HasBase(1, 0.base) returns true.

47 | 48 | 49 |

Objects, Obj.Base, ObjGetBase, HasMethod, HasProp

50 | 51 |

Examples

52 |
53 |

Illustrates the use of this function.

54 |
55 | thebase := {key: "value"}
56 | derived := {base: thebase}
57 | MsgBox HasBase(thebase, derived) ; 0
58 | MsgBox HasBase(derived, thebase) ; 1
59 | 
60 |
61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /docs/lib/HasProp.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HasProp - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

HasProp

15 | 16 |

Returns a non-zero number if the specified value has a property by the specified name.

17 | 18 |
HasProp := HasProp(Value, Name)
19 |

Parameters

20 |
21 |
Value
22 |
23 |

Type: Any

24 |

Any value, of any type except ComObject.

25 |
26 |
Name
27 |
28 |

Type: String

29 |

The property name to check for.

30 |
31 |
32 | 33 |

Return Value

34 |

Type: Integer (boolean)

35 |

This function returns 1 (true) if the value has a property by this name, otherwise 0 (false).

36 | 37 |

Remarks

38 |

This function does not test for the presence of a __Get or __Set meta-function. If present, there is no way to detect the exact set of properties that it may implement.

39 |

This function supports primitive values.

40 | 41 | 42 |

Objects, HasBase, HasMethod

43 | 44 |

Examples

45 |
46 |

Illustrates the use of this function.

47 |
48 | MsgBox HasProp({}, "x") ; 0
49 | MsgBox HasProp({x:1}, "x") ; 1
50 | MsgBox HasProp(0, "Base") ; 1
51 | 
52 |
53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /docs/lib/IniDelete.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IniDelete - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

IniDelete

14 | 15 |

Deletes a value from a standard format .ini file.

16 | 17 |
IniDelete Filename, Section , Key
18 |

Parameters

19 |
20 | 21 |
Filename
22 |
23 |

Type: String

24 |

The name of the .ini file, which is assumed to be in A_WorkingDir if an absolute path isn't specified.

25 |
26 | 27 |
Section
28 |
29 |

Type: String

30 |

The section name in the .ini file, which is the heading phrase that appears in square brackets (do not include the brackets in this parameter).

31 |
32 | 33 |
Key
34 |
35 |

Type: String

36 |

If omitted, the entire section will be deleted. Otherwise, specify the key name in the .ini file.

37 |
38 | 39 |
40 |

Error Handling

41 |

An OSError is thrown on failure.

42 |

Regardless of whether an exception is thrown, A_LastError is set to the result of the operating system's GetLastError() function.

43 | 44 |

Remarks

45 |

A standard ini file looks like:

46 |
[SectionName]
47 | Key=Value
48 | 49 |

IniRead, IniWrite, RegDelete, RegDeleteKey

50 |

Examples

51 |
52 |

Deletes a key and its value located in section2 from a standard format .ini file.

53 |
IniDelete "C:\Temp\myfile.ini", "section2", "key"
54 |
55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /docs/lib/Integer.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Integer - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Integer

15 |

Converts a numeric string or floating-point value to an integer.

16 |
IntValue := Integer(Value)
17 | 18 |

Return Value

19 |

Type: Integer

20 |

This function returns the result of converting Value to a pure integer (having the type name "Integer"), or Value itself if it is already the correct type.

21 | 22 |

Remarks

23 |

Any fractional part of Value is dropped, equivalent to Value < 0 ? Ceil(Value) : Floor(Value).

24 |

If the value cannot be converted, a TypeError is thrown.

25 |

To determine if a value can be converted to an integer, use the IsNumber function.

26 |

Integer is actually a class, but can be called as a function. Value is Integer can be used to check whether a value is a pure integer.

27 | 28 | 29 |

Type, Float, Number, String, Values, Expressions, Is functions

30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/lib/IsLabel.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IsLabel - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

IsLabel

14 | 15 |

Returns a non-zero number if the specified label exists in the current scope.

16 | 17 |
Boolean := IsLabel(LabelName)
18 |

Parameters

19 |
20 | 21 |
LabelName
22 |
23 |

Type: String

24 |

The name of a label. The trailing colon should not be included.

25 |
26 | 27 |
28 | 29 |

Return Value

30 |

Type: Integer (boolean)

31 |

This function returns 1 (true) if the specified label exists within the current scope, otherwise 0 (false).

32 | 33 |

Remarks

34 |

This function is useful to avoid runtime errors when specifying a dynamic label for Goto.

35 |

When called from inside a function, only that function's labels are searched. Global labels are not valid targets for a local goto.

36 | 37 | 38 |

Labels

39 |

Examples

40 |
41 |

Reports "Target label exists" because the label does exist.

42 |
if IsLabel("Label")
43 |     MsgBox "Target label exists"
44 | else
45 |     MsgBox "Target label doesn't exist"
46 | 
47 | Label:
48 | return
49 |
50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/lib/IsObject.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IsObject - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

IsObject

14 | 15 |

Returns a non-zero number if the specified value is an object.

16 | 17 |
Boolean := IsObject(Value)
18 |

Parameters

19 |
20 | 21 |
Value
22 |
23 |

Type: Any

24 |

The value to check.

25 |
26 | 27 |
28 | 29 |

Return Value

30 |

Type: Integer (boolean)

31 |

This function returns 1 (true) if Value is an object, otherwise 0 (false).

32 | 33 |

Remarks

34 |

Any value which is not a primitive value (number or string) is considered to be an object, including those which do not derive from Object, such as COM wrapper objects. This distinction is made because objects share several common traits in contrast to primitive values:

35 | 41 | 42 | 43 |

Objects

44 |

Examples

45 |
46 |

Reports "This is an object." because the value is an object.

47 |
obj := {key: "value"}
48 | 
49 | if IsObject(obj)
50 |     MsgBox "This is an object."
51 | else
52 |     MsgBox "This is not an object."
53 |
54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /docs/lib/ListHotkeys.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ListHotkeys - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

ListHotkeys

14 | 15 |

Displays the hotkeys in use by the current script, whether their subroutines are currently running, and whether or not they use the keyboard or mouse hook.

16 | 17 |
ListHotkeys
18 |

This function is equivalent to selecting the View->Hotkeys menu item in the main window.

19 |

If a hotkey has been disabled via the Hotkey function, it will be listed as OFF or PART ("PART" means that only some of the hotkey's variants are disabled).

20 |

If any of a hotkey's variants have a non-zero #InputLevel, the level (or minimum and maximum levels) are displayed.

21 |

If any of a hotkey's subroutines are currently running, the total number of threads is displayed for that hotkey.

22 |

Finally, the type of hotkey is also displayed, which is one of the following:

23 | 31 | 32 | 33 |

InstallKeybdHook, InstallMouseHook, #UseHook, KeyHistory, ListLines, ListVars, #MaxThreadsPerHotkey, A_MaxHotkeysPerInterval

34 | 35 |

Examples

36 |
37 |

Displays information about the hotkeys used by the current script.

38 |
ListHotkeys
39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/lib/ListVars.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ListVars - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

ListVars

14 | 15 |

Displays the script's variables: their names and current contents.

16 | 17 |
ListVars
18 |

Remarks

19 |

This function is equivalent to selecting the "View->Variables" menu item in the main window. It can help debug a script.

20 |

For each variable in the list, the variable's name and contents are shown, along with other information depending on what the variable contains. Each item is terminated with a carriage return and newline (`r`n), but may span multiple lines if the variable contains `r`n.

21 |

List items may take the following forms (where words in italics are placeholders):

22 |
23 | VarName[Length of Capacity]: String
24 | VarName: TypeName object {Info}
25 | VarName: Number
26 | 
27 |

Capacity is the variable's current capacity.

28 |

String is the first 60 characters of the variable's string value.

29 |

Info depends on the type of object, but is currently very limited.

30 |

If ListVars is used inside a function, the following are listed:

31 | 37 | 38 | 39 |

KeyHistory, ListHotkeys, ListLines

40 |

The DebugVars script can be used to inspect and change the contents of variables and objects.

41 | 42 |

Examples

43 |
44 |

Displays information about the script's variables.

45 |
var1 := "foo"
46 | var2 := "bar"
47 | obj := []
48 | ListVars
49 | Pause
50 |
51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/lib/MenuFromHandle.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MenuFromHandle - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

MenuFromHandle

15 | 16 |

Retrieves the Menu or MenuBar object corresponding to a Win32 menu handle.

17 | 18 |
Menu := MenuFromHandle(Handle)
19 |

Parameters

20 |
21 |
Handle
22 |

Type: Integer

23 |

A handle to a Win32 menu (of type HMENU).

24 |
25 |
26 | 27 |

Remarks

28 |

If the handle is invalid or does not correspond to a menu created by this script, the function returns an empty string.

29 | 30 | 31 |

Win32 Menus, Menu/MenuBar object, Menu.Handle, Menu()

32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/lib/MonitorGetCount.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MonitorGetCount - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

MonitorGetCount

15 | 16 |

Returns the total number of monitors.

17 | 18 |
Count := MonitorGetCount()
19 | 20 |

Parameters

21 |

This function has no parameters.

22 | 23 |

Return Value

24 |

Type: Integer

25 |

This function returns the total number of monitors.

26 | 27 |

Remarks

28 |

Unlike the SM_CMONITORS system property retrieved via SysGet(80), the return value includes all monitors, even those not being used as part of the desktop.

29 | 30 | 31 |

SysGet, Monitor functions

32 | 33 |

Examples

34 |

See example #1 on the Monitor Functions page for a demonstration of this function.

35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/lib/MonitorGetName.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MonitorGetName - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

MonitorGetName

15 | 16 |

Returns the operating system's name of the specified monitor.

17 | 18 |
Name := MonitorGetName(N)
19 | 20 |

Parameters

21 |
22 |
N
23 |
24 |

Type: Integer

25 |

If omitted, the primary monitor will be used. Otherwise, specify the monitor number, between 1 and the number returned by MonitorGetCount.

26 |
27 |
28 | 29 |

Return Value

30 |

Type: String

31 |

This function returns the operating system's name for the specified monitor.

32 | 33 |

Error Handling

34 |

An exception is thrown on failure.

35 | 36 | 37 |

SysGet, Monitor functions

38 | 39 |

Examples

40 |

See example #1 on the Monitor Functions page for a demonstration of this function.

41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/lib/MonitorGetPrimary.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MonitorGetPrimary - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

MonitorGetPrimary

15 | 16 |

Returns the number of the primary monitor.

17 | 18 |
Primary := MonitorGetPrimary()
19 | 20 |

Parameters

21 |

This function has no parameters.

22 | 23 |

Return Value

24 |

Type: Integer

25 |

This function returns the number of the primary monitor. In a single-monitor system, this will be always 1.

26 | 27 | 28 |

SysGet, Monitor functions

29 | 30 |

Examples

31 |

See example #1 on the Monitor Functions page for a demonstration of this function.

32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/lib/MonitorGetWorkArea.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MonitorGetWorkArea - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

MonitorGetWorkArea

15 | 16 |

Checks if the specified monitor exists and optionally retrieves the bounding coordinates of its working area.

17 | 18 |
ActualN := MonitorGetWorkArea(N, &Left, &Top, &Right, &Bottom)
19 | 20 |

Parameters

21 |
22 |
N
23 |
24 |

Type: Integer

25 |

If omitted, the primary monitor will be used. Otherwise, specify the monitor number, between 1 and the number returned by MonitorGetCount.

26 |
27 | 28 |
&Left, &Top, &Right, &Bottom
29 |
30 |

Type: VarRef

31 |

If omitted, the corresponding value will not be stored. Otherwise, specify references to the output variables in which to store the bounding coordinates of the working area, in pixels.

32 |
33 |
34 | 35 |

Return Value

36 |

Type: Integer

37 |

This function returns the monitor number (the same as N unless N was omitted).

38 | 39 |

Error Handling

40 |

On failure, an exception is thrown and the output variables are not modified.

41 | 42 |

Remarks

43 |

The working area of a monitor excludes the area occupied by the taskbar and other registered desktop toolbars.

44 | 45 | 46 |

MonitorGet, SysGet, Monitor functions

47 | 48 |

Examples

49 |

See example #1 on the Monitor Functions page for a demonstration of this function.

50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/lib/Number.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Number - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Number

15 |

Converts a numeric string to a pure integer or floating-point number.

16 |
NumValue := Number(Value)
17 | 18 |

Return Value

19 |

Type: Integer or Float

20 |

This function returns the result of converting Value to a pure integer or floating-point number, or Value itself if it is already an Integer or Float value.

21 | 22 |

Remarks

23 |

If the value cannot be converted, a TypeError is thrown.

24 |

To determine if a value can be converted to a number, use the IsNumber function.

25 |

Number is actually a class, but can be called as a function. Value is Number can be used to check whether a value is a pure number.

26 | 27 | 28 |

Type, Float, Integer, String, Values, Expressions, Is functions

29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/lib/ObjAddRef.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ObjAddRef / ObjRelease - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

ObjAddRef / ObjRelease

15 | 16 |

Increments or decrements an object's reference count.

17 | 18 |
NewRefCount := ObjAddRef(Ptr)
19 | NewRefCount := ObjRelease(Ptr)
20 |

Parameters

21 |
22 | 23 |
Ptr
24 |
25 |

Type: Integer

26 |

An unmanaged object pointer or COM interface pointer.

27 |
28 | 29 |
30 | 31 |

Return Value

32 |

Type: Integer

33 |

These functions return the new reference count. This value should be used only for debugging purposes.

34 | 35 | 36 |

Reference Counting

37 |

Although the following articles discuss reference counting as it applies to COM, they cover some important concepts and rules which generally also apply to AutoHotkey objects: IUnknown::AddRef, IUnknown::Release, Reference Counting Rules.

38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /docs/lib/ObjBindMethod.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ObjBindMethod - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

ObjBindMethod

14 | 15 |

Creates a BoundFunc object which calls a method of a given object.

16 | 17 |
BoundFunc := ObjBindMethod(Obj , Method, Params)
18 | 19 |

Parameters

20 |
21 | 22 |
Obj
23 |
24 |

Type: Object

25 |

Any object.

26 |
27 | 28 |
Method
29 |
30 |

Type: String

31 |

A method name. If omitted, the bound function calls Obj itself.

32 |
33 | 34 |
Params
35 |
36 |

Any number of parameters.

37 |
38 | 39 |
40 | 41 |

Remarks

42 |

For details and examples, see BoundFunc object.

43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/lib/Ord.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ord - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Ord

14 | 15 |

Returns the ordinal value (numeric character code) of the first character in the specified string.

16 | 17 |
Number := Ord(String)
18 |

Parameters

19 |
20 | 21 |
String
22 |
23 |

Type: String

24 |

The string whose ordinal value is retrieved.

25 |
26 | 27 |
28 | 29 |

Return Value

30 |

Type: Integer

31 |

This function returns the ordinal value of String, or 0 if String is empty. If String begins with a Unicode supplementary character, this function returns the corresponding Unicode character code (a number between 0x10000 and 0x10FFFF). Otherwise it returns a value in the range 0 to 255 (for ANSI) or 0 to 0xFFFF (for Unicode). See Unicode vs ANSI for details.

32 | 33 | 34 |

Chr

35 |

Examples

36 |
37 |

Both message boxes below show 116, because only the first character is considered.

38 |
MsgBox Ord("t") 
39 | MsgBox Ord("test")
40 |
41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/lib/OutputDebug.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OutputDebug - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

OutputDebug

14 | 15 |

Sends a string to the debugger (if any) for display.

16 | 17 |
OutputDebug Text
18 |

Parameters

19 |
20 | 21 |
Text
22 |
23 |

Type: String

24 |

The text to send to the debugger for display. This text may include linefeed characters (`n) to start new lines. In addition, a single long line can be broken up into several shorter ones by means of a continuation section.

25 |
26 | 27 |
28 | 29 |

Remarks

30 |

If the script's process has no debugger, the system debugger displays the string. If the system debugger is not active, this function has no effect.

31 |

One example of a debugger is DebugView, which is free and available at microsoft.com.

32 |

See also: other debugging methods

33 | 34 |

FileAppend, continuation sections

35 |

Examples

36 |
37 |

Sends a string to the debugger (if any) for display.

38 |
OutputDebug A_Now ': Because the window "' TargetWindowTitle '" did not exist, the process was aborted.'
39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/lib/ProcessExist.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ProcessExist - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

ProcessExist

15 | 16 |

Checks if the specified process exists.

17 | 18 |
PID := ProcessExist(PIDOrName)
19 | 20 |

Parameters

21 |
22 |
PIDOrName
23 |
24 |

Type: Integer or String

25 |

If omitted, the script's own process is used. Otherwise, specify either a number (the PID) or a process name:

26 |

PID: The Process ID, which is a number that uniquely identifies one specific process (this number is valid only during the lifetime of that process). The PID of a newly launched process can be determined via the Run function. Similarly, the PID of a window can be determined with WinGetPID.

27 |

Name: The name of a process is usually the same as its executable (without path), e.g. notepad.exe or winword.exe. Since a name might match multiple running processes, only the first process will be operated upon. The name is not case-sensitive.

28 |
29 |
30 | 31 |

Return Value

32 |

Type: Integer

33 |

This function returns the Process ID (PID) of the specified process. If there is no matching process, zero is returned.

34 | 35 | 36 |

Run, WinExist, Process functions, Win functions

37 | 38 |

Examples

39 |
40 |

Checks if a process of Notepad exists.

41 |
if (PID := ProcessExist("notepad.exe"))
42 |     MsgBox "Notepad exists and has the Process ID " PID "."
43 | else
44 |     MsgBox "Notepad does not exist."
45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/lib/ProcessGetParent.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ProcessGetParent - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

ProcessGetParent

15 | 16 |

Returns the process ID (PID) of the process which created the specified process.

17 | 18 |
PID := ProcessGetParent(PIDOrName)
19 | 20 |

Parameters

21 |
22 |
PIDOrName
23 |
24 |

Type: Integer or String

25 |

If omitted, the script's own process is used. Otherwise, specify either a number (the PID) or a process name:

26 |

PID: The Process ID, which is a number that uniquely identifies one specific process (this number is valid only during the lifetime of that process). The PID of a newly launched process can be determined via the Run function. Similarly, the PID of a window can be determined with WinGetPID. ProcessExist can also be used to discover a PID.

27 |

Name: The name of a process is usually the same as its executable (without path), e.g. notepad.exe or winword.exe. Since a name might match multiple running processes, only the first process will be operated upon. The name is not case-sensitive.

28 |
29 |
30 | 31 |

Return Value

32 |

Type: Integer

33 |

This function returns the process ID (PID) of the process which created the specified process.

34 | 35 |

Error Handling

36 |

A TargetError is thrown if the specified process could not be found.

37 | 38 |

Remarks

39 |

If the parent process is no longer running, there is some risk that the returned PID has been reused by the system, and now identifies a different process.

40 | 41 | 42 |

Process functions

43 | 44 |

Examples

45 |
46 |

Display the name of the process which launched the script.

47 |
try
48 |     MsgBox ProcessGetName(ProcessGetParent())
49 | catch
50 |     MsgBox "Unable to retrieve parent process name; the process has likely exited."
51 | 
52 |
53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /docs/lib/SetWorkingDir.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SetWorkingDir - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

SetWorkingDir

14 | 15 |

Changes the script's current working directory.

16 | 17 |
SetWorkingDir DirName
18 |

Parameters

19 |
20 | 21 |
DirName
22 |
23 |

Type: String

24 |

The name of the new working directory, which is assumed to be a subfolder of the current A_WorkingDir if an absolute path isn't specified.

25 |
26 | 27 |
28 | 29 |

Error Handling

30 |

An OSError is thrown on failure.

31 | 32 |

Remarks

33 |

The script's working directory is the default directory that is used to access files and folders when an absolute path has not been specified. In the following example, the file My Filename.txt is assumed to be in A_WorkingDir: FileAppend "A Line of Text", "My Filename.txt".

34 |

The script's working directory defaults to A_ScriptDir, regardless of how the script was launched. By contrast, the value of A_InitialWorkingDir is determined by how the script was launched. For example, if it was run via shortcut -- such as on the Start Menu -- its initial working directory is determined by the "Start in" field within the shortcut's properties.

35 |

Once changed, the new working directory is instantly and globally in effect throughout the script. All interrupted, paused, and newly launched threads are affected, including Timers.

36 | 37 |

A_WorkingDir, A_InitialWorkingDir, A_ScriptDir, DirSelect

38 |

Examples

39 |
40 |

Changes the script's current working directory.

41 |
SetWorkingDir "D:\My Folder\Temp"
42 |
43 | 44 |
45 |

Forces the script to use the folder it was initially launched from as its working directory.

46 |
SetWorkingDir A_InitialWorkingDir
47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/lib/Shutdown.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Shutdown - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Shutdown

14 | 15 |

Shuts down, restarts, or logs off the system.

16 | 17 |
Shutdown Flag
18 |

Parameters

19 |
20 | 21 |
Flag
22 |
23 |

Type: Integer

24 |

A combination (sum) of the following numbers:

25 | 32 |

Add the required values together. For example, to shutdown and power down the flag would be 9 (shutdown + power down = 1 + 8 = 9).

33 |

The "Force" value (4) forces all open applications to close. It should only be used in an emergency because it may cause any open applications to lose data.

34 |

The "Power down" value (8) shuts down the system and turns off the power.

35 |
36 | 37 |
38 | 39 |

Remarks

40 |

To have the system suspend or hibernate, see example #2 at the bottom of this page.

41 |

To turn off the monitor, see SendMessage example #1.

42 |

On a related note, a script can detect when the system is shutting down or the user is logging off via OnExit.

43 | 44 |

Run, ExitApp, OnExit

45 |

Examples

46 |
47 |

Forces a reboot (reboot + force = 2 + 4 = 6).

48 |
Shutdown 6
49 |
50 | 51 |
52 |

Calls the Windows API function "SetSuspendState" to have the system suspend or hibernate. Note that the second parameter may have no effect at all on newer systems.

53 |
; Parameter #1: Pass 1 instead of 0 to hibernate rather than suspend.
54 | ; Parameter #2: Pass 1 instead of 0 to suspend immediately rather than asking each application for permission.
55 | ; Parameter #3: Pass 1 instead of 0 to disable all wake events.
56 | DllCall("PowrProf\SetSuspendState", "Int", 0, "Int", 0, "Int", 0)
57 |
58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /docs/lib/SoundBeep.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SoundBeep - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

SoundBeep

14 | 15 |

Emits a tone from the PC speaker.

16 | 17 |
SoundBeep Frequency, Duration
18 |

Parameters

19 |
20 | 21 |
Frequency
22 |
23 |

Type: Integer

24 |

If omitted, it defaults to 523. Otherwise, specify the frequency of the sound, a number between 37 and 32767.

25 |
26 | 27 |
Duration
28 |
29 |

Type: Integer

30 |

If omitted, it defaults to 150. Otherwise, specify the duration of the sound, in milliseconds.

31 |
32 | 33 |
34 | 35 |

Remarks

36 |

The script waits for the sound to finish before continuing. In addition, system responsiveness might be reduced during sound production.

37 |

If the computer lacks a sound card, a standard beep is played through the PC speaker.

38 |

To produce the standard system sounds instead of beeping the PC Speaker, see the asterisk mode of SoundPlay.

39 | 40 |

SoundPlay

41 |

Examples

42 |
43 |

Plays the default pitch and duration.

44 |
SoundBeep
45 |
46 | 47 |
48 |

Plays a higher pitch for half a second.

49 |
SoundBeep 750, 500
50 |
51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/lib/StrLen.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | StrLen - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

StrLen

14 |

Retrieves the count of how many characters are in a string.

15 |
Length := StrLen(String)
16 | 17 |

Parameters

18 |
19 |
String
20 |
21 |

Type: String

22 |

The string whose contents will be measured.

23 |
24 |
25 | 26 |

Return Value

27 |

Type: Integer

28 |

This function returns the length of the specified string.

29 | 30 | 31 |

InStr, SubStr, Trim, StrLower, StrUpper, StrPut, StrGet, StrReplace, StrSplit

32 | 33 |

Examples

34 |
35 |

Retrieves and reports the count of how many characters are in a string.

36 |
StrValue := "The quick brown fox jumps over the lazy dog"
37 | MsgBox "The length of the string is " StrLen(StrValue) ; Result: 43
38 |
39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/lib/String.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | String - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

String

15 |

Converts a value to a string.

16 |
StrValue := String(Value)
17 | 18 |

Return Value

19 |

Type: String

20 |

This function returns the result of converting Value to a string, or Value itself if it is a string.

21 |

If Value is a number, the default decimal formatting is used.

22 |

If Value is an object, the return value is the result of calling Value.ToString(). If the object has no such method, a MethodError is thrown. This method is not implemented by default, so must be defined by the script.

23 | 24 | 25 |

Type, Integer, Float, Values, Expressions, Is functions

26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/lib/SubStr.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SubStr - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

SubStr

14 | 15 |

Retrieves one or more characters from the specified position in a string.

16 | 17 |
NewStr := SubStr(String, StartingPos , Length)
18 |

Parameters

19 |
20 | 21 |
String
22 |
23 |

Type: String

24 |

The string whose content is copied. This may contain binary zero.

25 |
26 | 27 |
StartingPos
28 |
29 |

Type: Integer

30 |

Specify 1 to start at the first character, 2 to start at the second, and so on. If StartingPos is 0 or beyond String's length, an empty string is returned.

31 |

Specify a negative StartingPos to start at that position from the right. For example, -1 extracts the last character and -2 extracts the two last characters. If StartingPos tries to go beyond the left end of the string, the extraction starts at the first character.

32 |
33 | 34 |
Length
35 |
36 |

Type: Integer

37 |

If omitted, it defaults to "all characters". Otherwise, specify the maximum number of characters to retrieve (fewer than the maximum are retrieved whenever the remaining part of the string is too short).

38 |

You can also specify a negative Length to omit that many characters from the end of the returned string (an empty string is returned if all or too many characters are omitted).

39 |
40 | 41 |
42 | 43 |

Return Value

44 |

Type: String

45 |

This function returns the requested substring of the specified string.

46 | 47 | 48 |

RegExMatch

49 | 50 |

Examples

51 |
52 |

Retrieves a substring with a length of 3 characters at position 4.

53 |
MsgBox SubStr("123abc789", 4, 3) ; Returns abc
54 |
55 | 56 |
57 |

Retrieves a substring from the beginning and end of a string.

58 |
Str := "The Quick Brown Fox Jumps Over the Lazy Dog"
59 | MsgBox SubStr(Str, 1, 19)  ; Returns "The Quick Brown Fox"
60 | MsgBox SubStr(Str, -8)  ; Returns "Lazy Dog"
61 | 
62 |
63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /docs/lib/SysGetIPAddresses.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SysGetIPAddresses - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

SysGetIPAddresses

15 | 16 |

Returns an array of the system's IPv4 addresses.

17 | 18 |
Addresses := SysGetIPAddresses()
19 | 20 |

Parameters

21 |

This function has no parameters.

22 | 23 |

Return Value

24 |

Type: Array

25 |

This function returns an array, where each element is an IPv4 address string such as "192.168.0.1".

26 | 27 |

Remarks

28 |

Currently only IPv4 is supported.

29 |

This function returns only the IP addresses of the computer's network adapters. If the computer is connected to the Internet through a router, this will not include the computer's public (Internet) IP address. To determine the computer's public IP address, use an external web API. For example:

30 |
whr := ComObject("WinHttp.WinHttpRequest.5.1")
31 | whr.Open("GET", "https://api.ipify.org")
32 | whr.Send()
33 | MsgBox "Public IP address: " whr.ResponseText
34 | 35 | 36 |

A_ComputerName

37 | 38 |

Examples

39 |
40 |

Retrieves and reports the system's IPv4 addresses.

41 |
addresses := SysGetIPAddresses()
42 | msg := "IP addresses:`n"
43 | for n, address in addresses
44 |     msg .= address "`n"
45 | MsgBox msg
46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/lib/Trim.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Trim / LTrim / RTrim - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Trim / LTrim / RTrim

14 | 15 |

Trims characters from the beginning and/or end of a string.

16 | 17 |
NewString :=  Trim(String , OmitChars)
18 | NewString := LTrim(String , OmitChars)
19 | NewString := RTrim(String , OmitChars)
20 |

Parameters

21 |
22 | 23 |
String
24 |
25 |

Type: String

26 |

Any string value or variable. Numbers are not supported.

27 |
28 | 29 |
OmitChars
30 |
31 |

Type: String

32 |

If omitted, spaces and tabs will be removed. Otherwise, specify a list of characters (case-sensitive) to exclude from the beginning and/or end of String.

33 |
34 | 35 |
36 | 37 |

Return Value

38 |

Type: String

39 |

These functions return the trimmed version of the specified string.

40 | 41 |

Examples

42 |
43 |

Trims all spaces from the left and right side of a string.

44 |
text := "  text  "
45 | MsgBox
46 | (
47 |     "No trim:`t'" text "'
48 |     Trim:`t'" Trim(text) "'
49 |     LTrim:`t'" LTrim(text) "'
50 |     RTrim:`t'" RTrim(text) "'"
51 | )
52 |
53 | 54 |
55 |

Trims all zeros from the left side of a string.

56 |
MsgBox LTrim("00000123", "0")
57 |
58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /docs/lib/Until.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Until - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Until

14 | 15 |

Applies a condition to the continuation of a Loop or For-loop.

16 | 17 |
Loop {
18 |     ...
19 | } Until Expression
20 |

Parameters

21 |
22 | 23 |
Expression
24 |

Any valid expression.

25 | 26 |
27 | 28 |

Remarks

29 |

The space or tab after Until is optional if the expression is enclosed in parentheses, as in until(expression).

30 |

The expression is evaluated once after each iteration, and is evaluated even if Continue was used. If the expression evaluates to false (which is an empty string or the number 0), the loop continues; otherwise, the loop is broken and execution continues at the line following Until.

31 |

Loop Until is shorthand for the following:

32 |
Loop {
33 |     ...
34 |     if (Expression)
35 |         break
36 | }
37 |

However, Loop Until is often easier to understand and unlike the above, can be used with a single-line action. For example:

38 |
Loop
39 |     x *= 2
40 | Until x > y
41 |

Until can be used with any Loop or For. For example:

42 |
Loop Read, A_ScriptFullPath
43 |     lines .= A_LoopReadLine . "`n"
44 | Until A_Index=5  ; Read the first five lines.
45 | MsgBox lines
46 | 
47 |

If A_Index is used in Expression, it contains the index of the iteration which has just finished.

48 | 49 | 50 |

Loop, While-loop, For-loop, Break, Continue, Blocks, Files-and-folders loop, Registry loop, File-reading loop, Parsing loop, If

51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/lib/WinGetCount.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinGetCount - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

WinGetCount

15 | 16 |

Returns the number of existing windows that match the specified criteria.

17 | 18 |
Count := WinGetCount(WinTitle, WinText, ExcludeTitle, ExcludeText)
19 | 20 |

Parameters

21 |
22 |
WinTitle, WinText, ExcludeTitle, ExcludeText
23 |
24 |

Type: String, Integer or Object

25 |

If each of these is blank or omitted, all windows on the entire system will be counted. Otherwise, specify for WinTitle a window title or other criteria to identify the target window and/or for WinText a substring from a single text element of the target window (as revealed by the included Window Spy utility).

26 |

ExcludeTitle and ExcludeText can be used to exclude one or more windows by their title or text. Their specification is similar to WinTitle and WinText, except that ExcludeTitle does not recognize any criteria other than the window title.

27 |

Window titles and text are case-sensitive. By default, hidden windows are not detected and hidden text elements are detected, unless changed with DetectHiddenWindows and DetectHiddenText; however, when using pure HWNDs, hidden windows are always detected regardless of DetectHiddenWindows. By default, a window title can contain WinTitle or ExcludeTitle anywhere inside it to be a match, unless changed with SetTitleMatchMode.

28 |
29 |
30 | 31 |

Return Value

32 |

Type: Integer

33 |

This function returns the number of existing windows that match the specified criteria. If there is no matching window, zero is returned.

34 | 35 |

Remarks

36 |

The ID of the window under the mouse cursor can be retrieved with MouseGetPos.

37 | 38 | 39 |

WinGetList, Win functions, Control functions

40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/lib/WinMinimizeAll.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinMinimizeAll / WinMinimizeAllUndo - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

WinMinimizeAll / WinMinimizeAllUndo

14 | 15 |

Minimizes or unminimizes all windows.

16 | 17 |
WinMinimizeAll
18 | WinMinimizeAllUndo
19 |

On most systems, this is equivalent to Explorer's Win+M and Win+D hotkeys.

20 | 21 |

WinMinimize, GroupAdd

22 |

Examples

23 |
24 |

Minimizes all windows for 1 second and unminimizes them.

25 |
WinMinimizeAll
26 | Sleep 1000
27 | WinMinimizeAllUndo
28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/lib/_ClipboardTimeout.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #ClipboardTimeout - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

#ClipboardTimeout

14 | 15 |

Changes how long the script keeps trying to access the clipboard when the first attempt fails.

16 | 17 |
#ClipboardTimeout Milliseconds
18 |

Parameters

19 |
20 | 21 |
Milliseconds
22 |
23 |

Type: Integer

24 |

The length of the interval in milliseconds. Specify -1 to have it keep trying indefinitely. Specify 0 to have it try only once.

25 |
26 | 27 |
28 |

Remarks

29 |

If this directive is unspecified in the script, it will behave as though set to 1000 (milliseconds).

30 |

Some applications keep the clipboard open for long periods of time, perhaps to write or read large amounts of data. In such cases, increasing this setting causes the script to wait longer before giving up and displaying an error message.

31 |

This settings applies to all clipboard operations, the simplest of which are the following examples: Var := A_Clipboard and A_Clipboard := "New Text".

32 |

Whenever the script is waiting for the clipboard to become available, new threads cannot be launched and timers will not run. However, if the user presses a hotkey, selects a custom menu item, or performs a GUI action such as pressing a button, that event will be buffered until later; in other words, its subroutine will be performed after the clipboard finally becomes available.

33 |

This directive does not cause the reading of clipboard data to be reattempted if the first attempt fails.

34 |

Like other directives, #ClipboardTimeout cannot be executed conditionally.

35 | 36 |

A_Clipboard, Thread

37 |

Examples

38 |
39 |

Causes the script to wait 2 seconds instead of 1 second before giving up accessing the clipboard and displaying an error message.

40 |
#ClipboardTimeout 2000
41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/lib/_HotIfTimeout.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #HotIfTimeout - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

#HotIfTimeout

16 | 17 |

Sets the maximum time that may be spent evaluating a single #HotIf expression.

18 | 19 |
#HotIfTimeout Timeout
20 |

Parameters

21 |
22 | 23 |
Timeout
24 |
25 |

Type: Integer

26 |

The timeout value to apply globally, in milliseconds.

27 |
28 | 29 |
30 | 31 |

Remarks

32 |

If this directive is unspecified in the script, it will behave as though set to 1000 (milliseconds).

33 |

A timeout is implemented to prevent long-running expressions from stalling keyboard input processing. If the timeout value is exceeded, the expression continues to evaluate, but the keyboard hook continues as if the expression had already returned false.

34 |

Note that the system implements its own timeout, defined by the DWORD value LowLevelHooksTimeout in the following registry key:

35 |

HKEY_CURRENT_USER\Control Panel\Desktop

36 |

If the system timeout value is exceeded, the system may stop calling the script's keyboard hook, thereby preventing hook hotkeys from working until the hook is re-registered or the script is reloaded. The hook can usually be re-registered by suspending and un-suspending all hotkeys.

37 |

Microsoft's documentation is unclear about the details of this timeout, but research indicates the following for Windows 7 and later: If LowLevelHooksTimeout is not defined, the default timeout is 300 ms. The hook may time out up to 10 times, but is silently removed if it times out an 11th time.

38 |

If a given hotkey has multiple #HotIf variants, the timeout might be applied to each variant independently, making it more likely that the system timeout will be exceeded. This may be changed in a future update.

39 |

Like other directives, #HotIfTimeout cannot be executed conditionally.

40 | 41 |

#HotIf

42 |

Examples

43 |
44 |

Sets the #HotIf timeout to 10 ms instead of 1000 ms.

45 |
#HotIfTimeout 10
46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/lib/_InputLevel.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #InputLevel - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

#InputLevel

14 |

Controls which artificial keyboard and mouse events are ignored by hotkeys and hotstrings.

15 |
#InputLevel Level
16 | 17 |

Parameters

18 |
19 | 20 |
Level
21 |
22 |

Type: Integer

23 |

If omitted, it defaults to 0. Otherwise, specify an integer between 0 and 100.

24 |
25 | 26 |
27 | 28 |

General Remarks

29 |

If this directive is unspecified in the script, it will behave as though set to 0.

30 |

For an explanation of how SendLevel and #InputLevel are used, see SendLevel.

31 |

This directive is positional: it affects all hotkeys and hotstrings between it and the next #InputLevel directive. If not specified by an #InputLevel directive, hotkeys and hotstrings default to level 0.

32 |

A hotkey's input level can also be set using the Hotkey function. For example: Hotkey "#z", my_hotkey_sub, "I1"

33 |

The input level of a hotkey or non-auto-replace hotstring is also used as the default send level for any keystrokes or button clicks generated by that hotkey or hotstring. Since a keyboard or mouse remapping is actually a pair of hotkeys, this allows #InputLevel to be used to allow remappings to trigger other hotkeys.

34 |

AutoHotkey versions older than v1.1.06 behave as though #InputLevel 0 and SendLevel 0 are in effect.

35 |

Like other directives, #InputLevel cannot be executed conditionally.

36 | 37 | 38 |

SendLevel, Hotkeys, Hotstrings

39 | 40 |

Examples

41 |
42 |

Causes the first hotkey *Numpad0:: to trigger the second hotkey ~LButton::. This would be not the case if the #InputLevel directives are omitted or commented out.

43 |
44 | #InputLevel 1
45 | ; Use SendEvent so that the script's own hotkeys can be triggered.
46 | *Numpad0::SendEvent "{Blind}{Click Down}"
47 | *Numpad0 up::SendEvent "{Blind}{Click Up}"
48 | #InputLevel 0
49 | ; This hotkey can be triggered by both Numpad0 and LButton:
50 | ~LButton::MsgBox "Clicked"
51 | 
52 |
53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /docs/lib/_MaxThreads.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #MaxThreads - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

#MaxThreads

14 | 15 |

Sets the maximum number of simultaneous threads.

16 | 17 |
#MaxThreads Value
18 |

Parameters

19 |
20 | 21 |
Value
22 |
23 |

Type: Integer

24 |

The maximum total number of threads that can exist simultaneously. Specifying a number higher than 255 is the same as specifying 255.

25 |
26 | 27 |
28 |

Remarks

29 |

If this directive is unspecified in the script, it will behave as though set to 10.

30 |

This setting is global, meaning that it needs to be specified only once (anywhere in the script) to affect the behavior of the entire script.

31 |

Although a value of 1 is allowed, it is not recommended because it would prevent new hotkeys from launching whenever the script is displaying a message box or other dialog. It would also prevent timers from running whenever another thread is sleeping or waiting.

32 |

The OnExit callback function will always launch regardless of how many threads exist.

33 |

If this setting is lower than #MaxThreadsPerHotkey, it effectively overrides that setting.

34 |

Like other directives, #MaxThreads cannot be executed conditionally.

35 | 36 |

#MaxThreadsPerHotkey, Threads, A_MaxHotkeysPerInterval, ListHotkeys

37 |

Examples

38 |
39 |

Allows a maximum of 2 instead of 10 simultaneous threads.

40 |
#MaxThreads 2
41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/lib/_MaxThreadsPerHotkey.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #MaxThreadsPerHotkey - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

#MaxThreadsPerHotkey

14 | 15 |

Sets the maximum number of simultaneous threads per hotkey or hotstring.

16 | 17 |
#MaxThreadsPerHotkey Value
18 |

Parameters

19 |
20 | 21 |
Value
22 |
23 |

Type: Integer

24 |

The maximum number of threads that can be launched for a given hotkey/hotstring subroutine (limit 255).

25 |
26 | 27 |
28 |

Remarks

29 |

If this directive is unspecified in the script, it will behave as though set to 1.

30 |

This setting is used to control how many "instances" of a given hotkey or hotstring subroutine are allowed to exist simultaneously. For example, if a hotkey has a max of 1 and it is pressed again while its subroutine is already running, the press will be ignored. This is helpful to prevent accidental double-presses. However, if you wish these keypresses to be buffered rather than ignored -- perhaps to increase the responsiveness of the keyboard's auto-repeat feature -- use #MaxThreadsBuffer.

31 |

Unlike #MaxThreads, this setting is not global. Instead, position it before the first hotkey you wish to have affected by it, which will result in all subsequent hotkeys using that value until another instance of this directive is encountered.

32 |

The setting of #MaxThreads -- if lower than this setting -- takes precedence.

33 |

Like other directives, #MaxThreadsPerHotkey cannot be executed conditionally.

34 | 35 |

#MaxThreads, #MaxThreadsBuffer, Critical, Threads, Hotkey, A_MaxHotkeysPerInterval, ListHotkeys

36 |

Examples

37 |
38 |

Allows a maximum of 3 simultaneous threads instead of 1 per hotkey or hotstring.

39 |
#MaxThreadsPerHotkey 3
40 |
41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/lib/_NoTrayIcon.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #NoTrayIcon - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

#NoTrayIcon

14 | 15 |

Disables the showing of a tray icon.

16 | 17 |
#NoTrayIcon
18 |

Specifying this anywhere in a script will prevent the showing of a tray icon for that script when it is launched (even if the script is compiled into an EXE).

19 |

If you use this for a script that has hotkeys, you might want to bind a hotkey to the ExitApp function. Otherwise, there will be no easy way to exit the program (without restarting the computer or killing the process). For example: #x::ExitApp.

20 |

The tray icon can be made to disappear or reappear at any time during the execution of the script by assigning a true or false value to A_IconHidden. The only drawback of using A_IconHidden := true at the very top of the script is that the tray icon might be briefly visible when the script is first launched. To avoid that, use #NoTrayIcon instead.

21 |

The built-in variable A_IconHidden contains 1 if the tray icon is currently hidden or 0 otherwise, and can be assigned a value to show or hide the icon.

22 | 23 |

Like other directives, #NoTrayIcon cannot be executed conditionally.

24 | 25 |

Tray Icon, TraySetIcon, A_IconHidden, A_IconTip, ExitApp

26 |

Examples

27 |
28 |

Causes the script to launch without a tray icon.

29 |
#NoTrayIcon
30 |
31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/lib/_SuspendExempt.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #SuspendExempt - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

#SuspendExempt

15 | 16 |

Exempts subsequent hotkeys and hotstrings from suspension.

17 | 18 |
#SuspendExempt Setting
19 |

Parameters

20 |
21 | 22 |
Setting
23 |
24 |

Type: String or Integer

25 |

If omitted, it defaults to True. Otherwise, specify one of the following literal values:

26 |

True or 1: Enables exemption for subsequent hotkeys and hotstrings.

27 |

False or 0: Disables exemption.

28 |
29 | 30 |
31 |

Remarks

32 |

If this directive is unspecified in the script, all hotkeys or hotstrings are disabled when the script is suspended, even those which call the Suspend function.

33 |

Hotkeys and hotstrings can be suspended by the Suspend function or via the tray icon or main window.

34 |

This directive does not affect the Hotkey or Hotstring functions, for which the S hotkey option or S hotstring option can be used instead.

35 |

Like other directives, #SuspendExempt cannot be executed conditionally.

36 | 37 | 38 |

Suspend, Hotkeys, Hotstrings

39 | 40 |

Examples

41 |
42 |

The first hotkey in this example toggles the suspension. To prevent this hotkey from being suspended after the suspension has been turned on and thus no longer being able to turn it off, it must be exempted.

43 |
#SuspendExempt  ; Exempt the following hotkey from Suspend.
44 | #Esc::Suspend -1
45 | #SuspendExempt False  ; Disable exemption for any hotkeys/hotstrings below this.
46 | ^1::MsgBox "This hotkey is affected by Suspend."
47 | 
48 |
49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/lib/_WinActivateForce.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #WinActivateForce - Syntax & Usage | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

#WinActivateForce

14 | 15 |

Skips the gentle method of activating a window and goes straight to the forceful method.

16 | 17 |
#WinActivateForce
18 |

Specifying this anywhere in a script will cause built-in functions that activate a window -- such as WinActivate, WinActivateBottom, and GroupActivate -- to skip the "gentle" method of activating a window and go straight to the more forceful methods.

19 |

Although this directive will usually not change how quickly or reliably a window is activated, it might prevent task bar buttons from flashing when different windows are activated quickly one after the other.

20 | 21 |

Remarks

22 |

Like other directives, #WinActivateForce cannot be executed conditionally.

23 | 24 | 25 |

WinActivate, WinActivateBottom, GroupActivate

26 |

Examples

27 |
28 |

Enables the forceful method of activating a window.

29 |
#WinActivateForce
30 |
31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/misc/Macros.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Creating a Keyboard Macro or Mouse Macro | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Creating a Keyboard Macro or Mouse Macro

15 | 16 |

A macro is a series of scripted actions that is "played" upon demand. The most common activity of a macro is to send simulated keystrokes and mouse clicks to one or more windows. Such windows respond to each keystroke and mouse click as though you had performed it manually, which allows repetitive tasks to be automated with high speed and reliability.

17 |

One of the most convenient ways to play back a macro is to assign it to a hotkey or hotstring. For example, the following hotkey would create an empty e-mail message and prepare it for a certain type recipient, allowing you to personalize it prior to sending:

18 |
^!s::  ; Control+Alt+S hotkey.
19 | {
20 |     if not WinExist("Inbox - Microsoft Outlook")
21 |         return  ; Outlook isn't open to the right section, so do nothing.
22 |     WinActivate  ; Activate the window found by the above function.
23 |     Send "^n"  ; Create new/blank e-mail via Control+N.
24 |     WinWaitActive "Untitled Message"
25 |     Send "{Tab 2}Product Recall for ACME Rocket Skates"  ; Set the subject line.
26 |     Send "{Tab}Dear Sir or Madam,{Enter 2}We have recently discovered a minor defect ..."  ; etc.
27 | } ; This brace marks the end of the hotkey.
28 |

Hotkey macros like the above are especially useful for tasks you perform several times per day. By contrast, macros used less often can each be kept in a separate script accessible by means of a shortcut in the Start Menu or on the desktop.

29 |

To start creating your own macros and hotkeys right away, please read the Quick-start Tutorial.

30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/misc/Override.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Overriding or Disabling External Hotkeys | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Overriding or Disabling External Hotkeys

14 | 15 |

You can disable all built-in Windows hotkeys except Win+L and Win+U by making the following change to the registry (this should work on all OSes but a reboot is probably required):

16 |
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
17 | NoWinKeys REG_DWORD 0x00000001 (1)
18 |

But read on if you want to do more than just disable them all.

19 |

Hotkeys owned by another application can be overridden or disabled simply by assigning them to an action in the script. The most common use for this feature is to change the hotkeys that are built into Windows itself. For example, if you wish Win+E (the shortcut key that launches Windows Explorer) to perform some other action, use this:

20 |
#e::MsgBox "This hotkey is now owned by the script."
21 |

In the next example, the Win+R hotkey, which is used to open the RUN window, is completely disabled:

22 |
#r::return
23 |

Similarly, to disable both Win, use this:

24 |
LWin::return
25 | RWin::return
26 |

To disable or change an application's non-global hotkey (that is, a shortcut key that only works when that application is the active window), consider the following example which disables Ctrl+P (Print) only for Notepad, leaving the key in effect for all other types of windows:

27 |
$^p::
28 | {
29 | 	if WinActive("ahk_class Notepad")
30 | 		return  ; i.e. do nothing, which causes Ctrl+P to do nothing in Notepad.
31 | 	Send "^p"
32 | }
33 |

In the above example, the $ prefix is needed so that the hotkey can "send itself" without activating itself (which would otherwise trigger a warning dialog about an infinite loop). See also: Context-sensitive Hotkeys.

34 |

You can try out any of the above examples by copying them into a new text file such as "Override.ahk", then launching the file. Alternatively, if your browser supports it, you can download any of them as a script file by clicking the button which appears in the top-right of the code block when you hover your mouse over it.

35 | 36 | 37 | -------------------------------------------------------------------------------- /docs/misc/Performance.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Script Performance | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Script Performance

14 | 15 |

The following functions may affect performance depending on the nature of the script: SendMode, SetKeyDelay, SetMouseDelay, SetWinDelay, SetControlDelay, and SetDefaultMouseSpeed.

16 |

Built-in Performance Features

17 |

Each script is semi-compiled while it is being loaded and syntax-checked. In addition to detecting some errors early, this also greatly improves runtime performance.

18 |

Here are some of the technical details of the optimization process (semi-compiling):

19 | 27 |

In addition, during script execution, binary numbers are cached in variables to avoid conversions to/from strings.

28 | 29 | 30 | -------------------------------------------------------------------------------- /docs/misc/Winamp.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Automating Winamp | AutoHotkey v2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Automating Winamp

14 | 15 |

This page demonstrates how to control Winamp via hotkey even when it is minimized or inactive. This information has been tested with Winamp 2.78c but should work for other major releases as well. Please post changes and improvements in the forum.

16 |

This example makes the Ctrl+Alt+P hotkey equivalent to pressing Winamp's pause/unpause button:

17 |
^!p::
18 | {
19 |     if not WinExist("ahk_class Winamp v1.x")
20 |         return
21 | ; Otherwise, the above has set the "last found" window for use below.
22 | ControlSend "c"  ; Pause/Unpause
23 | }
24 |

Here are some of the keyboard shortcuts available in Winamp 2.x (may work in other versions too). The above example can be revised to use any of these keys:

25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 |
Key to sendEffect
cPause/UnPause
xPlay/Restart/UnPause
vStop
+vStop with Fadeout
^vStop after the current track
bNext Track
zPrevious Track
{left}Rewind 5 seconds
{right}Fast-forward 5 seconds
{up}Turn Volume Up
{down}Turn Volume Down
75 |

The following example asks Winamp which track number is currently active:

76 |
77 | TrackNumber := SendMessage(0x0400, 0, 120,, "ahk_class Winamp v1.x")
78 | if (TrackNumber != "")
79 | {
80 |     TrackNumber += 1  ; Winamp's count starts at 0, so adjust by 1.
81 |     MsgBox "Track #" TrackNumber " is active or playing."
82 | }
83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/misc/remove-userchoice.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ahk\UserChoice] 4 | -------------------------------------------------------------------------------- /docs/scripts/ContextSensitiveHelp.ahk: -------------------------------------------------------------------------------- 1 | ; Context Sensitive Help in Any Editor (based on the v1 script by Rajat) 2 | ; https://www.autohotkey.com 3 | ; This script makes Ctrl+2 (or another hotkey of your choice) show the help file 4 | ; page for the selected AutoHotkey function or keyword. If nothing is selected, 5 | ; the function name will be extracted from the beginning of the current line. 6 | 7 | ; The hotkey below uses the clipboard to provide compatibility with the maximum 8 | ; number of editors (since ControlGet doesn't work with most advanced editors). 9 | ; It restores the original clipboard contents afterward, but as plain text, 10 | ; which seems better than nothing. 11 | 12 | $^2:: 13 | { 14 | ; The following values are in effect only for the duration of this hotkey thread. 15 | ; Therefore, there is no need to change them back to their original values 16 | ; because that is done automatically when the thread ends: 17 | SetWinDelay 10 18 | SetKeyDelay 0 19 | 20 | C_ClipboardPrev := A_Clipboard 21 | A_Clipboard := "" 22 | ; Use the highlighted word if there is one (since sometimes the user might 23 | ; intentionally highlight something that isn't a function): 24 | Send "^c" 25 | if !ClipWait(0.1) 26 | { 27 | ; Get the entire line because editors treat cursor navigation keys differently: 28 | Send "{home}+{end}^c" 29 | if !ClipWait(0.2) ; Rare, so no error is reported. 30 | { 31 | A_Clipboard := C_ClipboardPrev 32 | return 33 | } 34 | } 35 | C_Cmd := Trim(A_Clipboard) ; This will trim leading and trailing tabs & spaces. 36 | A_Clipboard := C_ClipboardPrev ; Restore the original clipboard for the user. 37 | Loop Parse, C_Cmd, "`s" ; The first space is the end of the function. 38 | { 39 | C_Cmd := A_LoopField 40 | break ; i.e. we only need one interation. 41 | } 42 | if !WinExist("AutoHotkey Help") 43 | { 44 | ; Determine AutoHotkey's location: 45 | try 46 | ahk_dir := RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoHotkey", "InstallDir") 47 | catch ; Not found, so look for it in some other common locations. 48 | { 49 | if A_AhkPath 50 | SplitPath A_AhkPath,, &ahk_dir 51 | else if FileExist("..\..\AutoHotkey.chm") 52 | ahk_dir := "..\.." 53 | else if FileExist(A_ProgramFiles "\AutoHotkey\AutoHotkey.chm") 54 | ahk_dir := A_ProgramFiles "\AutoHotkey" 55 | else 56 | { 57 | MsgBox "Could not find the AutoHotkey folder." 58 | return 59 | } 60 | } 61 | Run ahk_dir "\AutoHotkey.chm" 62 | WinWait "AutoHotkey Help" 63 | } 64 | ; The above has set the "last found" window which we use below: 65 | WinActivate 66 | WinWaitActive 67 | C_Cmd := StrReplace(C_Cmd, "#", "{#}") 68 | Send "!n{home}+{end}" C_Cmd "{enter}" 69 | } 70 | -------------------------------------------------------------------------------- /docs/scripts/EasyWindowDrag.ahk: -------------------------------------------------------------------------------- 1 | ; Easy Window Dragging 2 | ; https://www.autohotkey.com 3 | ; Normally, a window can only be dragged by clicking on its title bar. 4 | ; This script extends that so that any point inside a window can be dragged. 5 | ; To activate this mode, hold down CapsLock or the middle mouse button while 6 | ; clicking, then drag the window to a new position. 7 | 8 | ; Note: You can optionally release CapsLock or the middle mouse button after 9 | ; pressing down the mouse button rather than holding it down the whole time. 10 | 11 | ~MButton & LButton:: 12 | CapsLock & LButton:: 13 | EWD_MoveWindow(*) 14 | { 15 | CoordMode "Mouse" ; Switch to screen/absolute coordinates. 16 | MouseGetPos &EWD_MouseStartX, &EWD_MouseStartY, &EWD_MouseWin 17 | WinGetPos &EWD_OriginalPosX, &EWD_OriginalPosY,,, EWD_MouseWin 18 | if !WinGetMinMax(EWD_MouseWin) ; Only if the window isn't maximized 19 | SetTimer EWD_WatchMouse, 10 ; Track the mouse as the user drags it. 20 | 21 | EWD_WatchMouse() 22 | { 23 | if !GetKeyState("LButton", "P") ; Button has been released, so drag is complete. 24 | { 25 | SetTimer , 0 26 | return 27 | } 28 | if GetKeyState("Escape", "P") ; Escape has been pressed, so drag is cancelled. 29 | { 30 | SetTimer , 0 31 | WinMove EWD_OriginalPosX, EWD_OriginalPosY,,, EWD_MouseWin 32 | return 33 | } 34 | ; Otherwise, reposition the window to match the change in mouse coordinates 35 | ; caused by the user having dragged the mouse: 36 | CoordMode "Mouse" 37 | MouseGetPos &EWD_MouseX, &EWD_MouseY 38 | WinGetPos &EWD_WinX, &EWD_WinY,,, EWD_MouseWin 39 | SetWinDelay -1 ; Makes the below move faster/smoother. 40 | WinMove EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY,,, EWD_MouseWin 41 | EWD_MouseStartX := EWD_MouseX ; Update for the next timer-call to this subroutine. 42 | EWD_MouseStartY := EWD_MouseY 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /docs/scripts/MsgBoxButtonNames.ahk: -------------------------------------------------------------------------------- 1 | ; Changing MsgBox's Button Names 2 | ; https://www.autohotkey.com 3 | ; This is a working example script that uses a timer to change 4 | ; the names of the buttons in a message box. Although the button 5 | ; names are changed, the MsgBox's return value still requires that the 6 | ; buttons be referred to by their original names. 7 | 8 | #SingleInstance 9 | SetTimer ChangeButtonNames, 50 10 | Result := MsgBox("Choose a button:", "Add or Delete", 4) 11 | if Result = "Yes" 12 | MsgBox "You chose Add." 13 | else 14 | MsgBox "You chose Delete." 15 | 16 | ChangeButtonNames() 17 | { 18 | if !WinExist("Add or Delete") 19 | return ; Keep waiting. 20 | SetTimer , 0 21 | WinActivate 22 | ControlSetText "&Add", "Button1" 23 | ControlSetText "&Delete", "Button2" 24 | } 25 | -------------------------------------------------------------------------------- /docs/scripts/Numpad000.ahk: -------------------------------------------------------------------------------- 1 | ; Numpad 000 Key 2 | ; https://www.autohotkey.com 3 | ; This example script makes the special 000 key that appears on certain 4 | ; keypads into an equals key. You can change the action by replacing the 5 | ; Send "=" line with line(s) of your choice. 6 | 7 | #MaxThreadsPerHotkey 5 ; Allow multiple threads for this hotkey. 8 | $Numpad0:: 9 | { 10 | #MaxThreadsPerHotkey 1 11 | ; Above: Use the $ to force the hook to be used, which prevents an 12 | ; infinite loop since this subroutine itself sends Numpad0, which 13 | ; would otherwise result in a recursive call to itself. 14 | DelayBetweenKeys := 30 ; Adjust this value if it doesn't work. 15 | if A_PriorHotkey = A_ThisHotkey 16 | { 17 | if A_TimeSincePriorHotkey < DelayBetweenKeys 18 | { 19 | if Numpad0Count = "" 20 | Numpad0Count := 2 ; i.e. This one plus the prior one. 21 | else if Numpad0Count = 0 22 | Numpad0Count := 2 23 | else 24 | { 25 | ; Since we're here, Numpad0Count must be 2 as set by 26 | ; prior calls, which means this is the third time the 27 | ; the key has been pressed. Thus, the hotkey sequence 28 | ; should fire: 29 | Numpad0Count := 0 30 | Send "=" ; ******* This is the action for the 000 key 31 | } 32 | ; In all the above cases, we return without further action: 33 | CalledReentrantly := true 34 | return 35 | } 36 | } 37 | ; Otherwise, this Numpad0 event is either the first in the series 38 | ; or it happened too long after the first one (e.g. perhaps the 39 | ; user is holding down the Numpad0 key to auto-repeat it, which 40 | ; we want to allow). Therefore, after a short delay -- during 41 | ; which another Numpad0 hotkey event may re-entrantly call this 42 | ; subroutine -- we'll send the key on through if no reentrant 43 | ; calls occurred: 44 | Numpad0Count := 0 45 | CalledReentrantly := false 46 | ; During this sleep, this subroutine may be reentrantly called 47 | ; (i.e. a simultaneous "thread" which runs in parallel to the 48 | ; call we're in now): 49 | Sleep DelayBetweenKeys 50 | if CalledReentrantly = true ; Another "thread" changed the value. 51 | { 52 | ; Since it was called reentrantly, this key event was the first in 53 | ; the sequence so should be suppressed (hidden from the system): 54 | CalledReentrantly := false 55 | return 56 | } 57 | ; Otherwise it's not part of the sequence so we send it through normally. 58 | ; In other words, the *real* Numpad0 key has been pressed, so we want it 59 | ; to have its normal effect: 60 | Send "{Numpad0}" 61 | } 62 | -------------------------------------------------------------------------------- /docs/scripts/VolumeOSD.ahk: -------------------------------------------------------------------------------- 1 | /* 2 | Volume On-Screen-Display (based on the v1 script by Rajat) 3 | https://www.autohotkey.com 4 | This script assigns hotkeys of your choice to raise and lower the master wave volume. 5 | */ 6 | 7 | ; --- User Settings --- 8 | 9 | ; The percentage by which to raise or lower the volume each time: 10 | g_Step := 4 11 | 12 | ; How long to display the volume level bar graphs: 13 | g_DisplayTime := 2000 14 | 15 | ; Master Volume Bar color (see the help file to use more precise shades): 16 | g_CBM := "Red" 17 | 18 | ; Background color: 19 | g_CW := "Silver" 20 | 21 | ; Bar's screen position. Use "center" to center the bar in that dimension: 22 | g_PosX := "center" 23 | g_PosY := "center" 24 | g_Width := 150 ; width of bar 25 | g_Thick := 12 ; thickness of bar 26 | 27 | ; If your keyboard has multimedia buttons for Volume, you can 28 | ; try changing the below hotkeys to use them by specifying 29 | ; Volume_Up and Volume_Down: 30 | g_MasterUp := "#Up" ; Win+UpArrow 31 | g_MasterDown := "#Down" 32 | 33 | ; --- Auto Execute Section --- 34 | 35 | ; DON'T CHANGE ANYTHING HERE (unless you know what you're doing). 36 | 37 | #SingleInstance 38 | 39 | ; Create the Progress window: 40 | G := Gui("+ToolWindow -Caption -Border +Disabled") 41 | G.MarginX := 0, G.MarginY := 0 42 | opt := "w" g_Width " h" g_Thick " background" g_CW 43 | Master := G.Add("Progress", opt " c" g_CBM) 44 | 45 | ; Register hotkeys: 46 | Hotkey g_MasterUp, (*) => ChangeVolume("+") 47 | Hotkey g_MasterDown, (*) => ChangeVolume("-") 48 | 49 | ; --- Function Definitions --- 50 | 51 | ChangeVolume(Prefix) 52 | { 53 | SoundSetVolume(Prefix g_Step) 54 | Master.Value := Round(SoundGetVolume()) 55 | G.Show("x" g_PosX " y" g_PosY) 56 | SetTimer HideWindow, -g_DisplayTime 57 | } 58 | 59 | HideWindow() 60 | { 61 | G.Hide() 62 | } 63 | -------------------------------------------------------------------------------- /docs/scripts/WindowShading.ahk: -------------------------------------------------------------------------------- 1 | ; Window Shading (based on the v1 script by Rajat) 2 | ; https://www.autohotkey.com 3 | ; This script reduces a window to its title bar and then back to its 4 | ; original size by pressing a single hotkey. Any number of windows 5 | ; can be reduced in this fashion (the script remembers each). If the 6 | ; script exits for any reason, all "rolled up" windows will be 7 | ; automatically restored to their original heights. 8 | 9 | ; Set the height of a rolled up window here. The operating system 10 | ; probably won't allow the title bar to be hidden regardless of 11 | ; how low this number is: 12 | g_MinHeight := 25 13 | 14 | ; This line will unroll any rolled up windows if the script exits 15 | ; for any reason: 16 | OnExit ExitSub 17 | 18 | IDs := Array() 19 | Windows := Map() 20 | 21 | #z:: ; Change this line to pick a different hotkey. 22 | ; Below this point, no changes should be made unless you want to 23 | ; alter the script's basic functionality. 24 | { 25 | ; Uncomment this next line if this subroutine is to be converted 26 | ; into a custom menu item rather than a hotkey. The delay allows 27 | ; the active window that was deactivated by the displayed menu to 28 | ; become active again: 29 | ;Sleep 200 30 | ActiveID := WinGetID("A") 31 | for ID in IDs 32 | { 33 | if ID = ActiveID 34 | { 35 | ; Match found, so this window should be restored (unrolled): 36 | Height := Windows[ActiveID] 37 | WinMove ,,, Height, ActiveID 38 | IDs.RemoveAt(A_Index) 39 | return 40 | } 41 | } 42 | WinGetPos ,,, &Height, "A" 43 | Windows.Set(ActiveID, Height) 44 | WinMove ,,, g_MinHeight, ActiveID 45 | IDs.Push(ActiveID) 46 | } 47 | 48 | ExitSub(*) 49 | { 50 | for ID in IDs 51 | { 52 | Height := Windows[ID] 53 | WinMove ,,, Height, ID 54 | } 55 | ExitApp ; Must do this for the OnExit subroutine to actually Exit the script. 56 | } 57 | -------------------------------------------------------------------------------- /docs/search.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Searching...

13 | 14 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /docs/static/ahk16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ahk16.png -------------------------------------------------------------------------------- /docs/static/ahk16_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ahk16_pause.png -------------------------------------------------------------------------------- /docs/static/ahk16_pause_suspend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ahk16_pause_suspend.png -------------------------------------------------------------------------------- /docs/static/ahk16_suspend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ahk16_suspend.png -------------------------------------------------------------------------------- /docs/static/ahk_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ahk_logo.png -------------------------------------------------------------------------------- /docs/static/ahk_logo_no_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ahk_logo_no_text.png -------------------------------------------------------------------------------- /docs/static/ahkfile16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ahkfile16.png -------------------------------------------------------------------------------- /docs/static/ctrl_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_button.png -------------------------------------------------------------------------------- /docs/static/ctrl_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_check.png -------------------------------------------------------------------------------- /docs/static/ctrl_combo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_combo.png -------------------------------------------------------------------------------- /docs/static/ctrl_datetime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_datetime.png -------------------------------------------------------------------------------- /docs/static/ctrl_ddl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_ddl.png -------------------------------------------------------------------------------- /docs/static/ctrl_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_edit.png -------------------------------------------------------------------------------- /docs/static/ctrl_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_group.png -------------------------------------------------------------------------------- /docs/static/ctrl_hotkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_hotkey.png -------------------------------------------------------------------------------- /docs/static/ctrl_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_link.png -------------------------------------------------------------------------------- /docs/static/ctrl_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_list.png -------------------------------------------------------------------------------- /docs/static/ctrl_listview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_listview.png -------------------------------------------------------------------------------- /docs/static/ctrl_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_menu.png -------------------------------------------------------------------------------- /docs/static/ctrl_monthcal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_monthcal.png -------------------------------------------------------------------------------- /docs/static/ctrl_progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_progress.png -------------------------------------------------------------------------------- /docs/static/ctrl_radio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_radio.png -------------------------------------------------------------------------------- /docs/static/ctrl_slider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_slider.png -------------------------------------------------------------------------------- /docs/static/ctrl_status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_status.png -------------------------------------------------------------------------------- /docs/static/ctrl_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_tab.png -------------------------------------------------------------------------------- /docs/static/ctrl_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_text.png -------------------------------------------------------------------------------- /docs/static/ctrl_treeview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_treeview.png -------------------------------------------------------------------------------- /docs/static/ctrl_updown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/ctrl_updown.png -------------------------------------------------------------------------------- /docs/static/dlg_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/dlg_file.png -------------------------------------------------------------------------------- /docs/static/dlg_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/dlg_folder.png -------------------------------------------------------------------------------- /docs/static/dlg_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/dlg_input.png -------------------------------------------------------------------------------- /docs/static/dlg_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/dlg_message.png -------------------------------------------------------------------------------- /docs/static/dlg_tooltip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/dlg_tooltip.png -------------------------------------------------------------------------------- /docs/static/dlg_traytip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/dlg_traytip.png -------------------------------------------------------------------------------- /docs/static/fonts/icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/fonts/icons.eot -------------------------------------------------------------------------------- /docs/static/fonts/icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/fonts/icons.ttf -------------------------------------------------------------------------------- /docs/static/fonts/icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/fonts/icons.woff -------------------------------------------------------------------------------- /docs/static/highlighter/dark.css: -------------------------------------------------------------------------------- 1 | @import url('highlighter.css'); 2 | 3 | .highlight>.cmd, 4 | .highlight>.bif { 5 | color: #569cd6; 6 | } 7 | 8 | .highlight>.met { 9 | color: #60c5dc; 10 | } 11 | 12 | .highlight>.cfs, 13 | .highlight>.dec { 14 | color: #c586c0; 15 | } 16 | 17 | .highlight>.str { 18 | color: #ce9178; 19 | } 20 | 21 | .highlight .str>.esc, 22 | .highlight .lab>.esc { 23 | color: #d7ba7d; 24 | } 25 | 26 | .highlight>.biv, 27 | .highlight>.cls { 28 | color: #4ec9b0; 29 | } 30 | 31 | .highlight>.dir { 32 | color: #dcdcaa; 33 | } 34 | 35 | .highlight>.lab, 36 | .highlight>.fun { 37 | font-weight: normal; 38 | color: #dcdcaa; 39 | } 40 | 41 | .highlight>.num { 42 | color: #b5cea8; 43 | } 44 | 45 | .highlight .cmt { 46 | color: #6a9955; 47 | } 48 | 49 | .highlight.line-numbers .line-numbers-rows { 50 | border-right-color: #999; 51 | } 52 | 53 | .highlight.line-numbers .line-numbers-rows>span:before { 54 | color: #999; 55 | } 56 | -------------------------------------------------------------------------------- /docs/static/highlighter/highlighter.css: -------------------------------------------------------------------------------- 1 | .highlight span>a, 2 | .highlight span>a:hover { 3 | color: inherit !important; 4 | } 5 | 6 | .highlight span>a { 7 | text-decoration: none; 8 | } 9 | 10 | .highlight.line-numbers-hide .line-numbers-rows { 11 | display: none; 12 | } 13 | 14 | .highlight.line-numbers { 15 | white-space: pre; 16 | overflow-x: auto; 17 | } 18 | 19 | .highlight.line-numbers .line-numbers-rows { 20 | position: absolute; 21 | pointer-events: none; 22 | top: 0; 23 | font-size: 100%; 24 | left: 0; 25 | width: 3em; 26 | letter-spacing: -1px; 27 | border-right: 1px solid; 28 | -webkit-user-select: none; 29 | -moz-user-select: none; 30 | -ms-user-select: none; 31 | user-select: none; 32 | } 33 | 34 | .highlight.line-numbers .line-numbers-rows>span { 35 | display: block; 36 | counter-increment: linenumber; 37 | } 38 | 39 | .highlight.line-numbers .line-numbers-rows>span:before { 40 | content: counter(linenumber); 41 | display: block; 42 | padding-right: 0.8em; 43 | text-align: right; 44 | } 45 | 46 | .highlight code { 47 | position: relative; 48 | display: block; 49 | background-color: inherit; 50 | color: inherit; 51 | } 52 | 53 | .highlight.line-numbers code { 54 | padding-left: 3.8em; 55 | } 56 | -------------------------------------------------------------------------------- /docs/static/highlighter/light.css: -------------------------------------------------------------------------------- 1 | @import url('highlighter.css'); 2 | 3 | .highlight>.bif { 4 | color: #0148c2; 5 | } 6 | 7 | .highlight>.met { 8 | color: #097f9a; 9 | } 10 | 11 | .highlight>.cfs, 12 | .highlight>.dec { 13 | color: #6F008A; 14 | } 15 | 16 | .highlight>.str { 17 | color: #A31515; 18 | } 19 | 20 | .highlight .str>.esc { 21 | color: #FF0000; 22 | } 23 | 24 | .highlight>.biv, 25 | .highlight>.cls { 26 | color: #006400; 27 | } 28 | 29 | .highlight>.dir { 30 | color: green; 31 | } 32 | 33 | .highlight>.lab, 34 | .highlight>.fun { 35 | font-weight: bold; 36 | color: #290e90; 37 | } 38 | 39 | .highlight .lab>.esc { 40 | color: #0d6bff; 41 | } 42 | 43 | .highlight>.num { 44 | color: #1a6c4e; 45 | } 46 | 47 | .highlight>.cmt { 48 | color: #708090; 49 | } 50 | 51 | .highlight.line-numbers .line-numbers-rows { 52 | border-right-color: #999; 53 | } 54 | 55 | .highlight.line-numbers .line-numbers-rows>span:before { 56 | color: #999; 57 | } 58 | -------------------------------------------------------------------------------- /docs/static/sound_levels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/v2/docs/static/sound_levels.png -------------------------------------------------------------------------------- /docs/static/source/check_data.ahk: -------------------------------------------------------------------------------- 1 | #Requires AutoHotkey v2 2 | 3 | SetWorkingDir(A_ScriptDir "\..\..") ; Required. 4 | 5 | if !RegExMatch(A_WorkingDir, "\\docs$") ; Sanity check. 6 | MsgBox("Working dir is not \docs.`n" A_WorkingDir, "", 48) 7 | 8 | file_indexed := Map() 9 | 10 | ; Check for missing files and anchors referenced in the index. 11 | datafile := A_WorkingDir "\static\source\data_index.js" 12 | loop read, datafile 13 | { 14 | if RegExMatch(A_LoopReadLine, '\["(.*?)","(.*?)"', &m) 15 | { 16 | CheckHREF(m[1], m[2]) 17 | } 18 | } 19 | 20 | ; Check for missing files and anchors referenced in the TOC. 21 | datafile := A_WorkingDir "\static\source\data_toc.js" 22 | loop read, datafile 23 | { 24 | if RegExMatch(A_LoopReadLine, '\["(.*?)","(.+?)"', &m) 25 | { 26 | CheckHREF(m[1], m[2]) 27 | } 28 | } 29 | 30 | ; Check for files which aren't in the index or TOC. 31 | ; Note that some are intentionally omitted. 32 | if false 33 | loop files, "*.htm", "FR" 34 | { 35 | path := A_LoopFilePath 36 | if !file_indexed.Has(path) 37 | D("file not in index or TOC: " path) 38 | } 39 | 40 | CheckHREF(topic, href) 41 | { 42 | global file_indexed, datafile 43 | href := StrSplit(href, "#") 44 | try 45 | html := FileRead(href[1]) 46 | catch 47 | D(datafile " (" A_Index ") : " href[1]) 48 | else if href.length != 1 && !InStr(html, 'id="' href[2] '"') 49 | D(datafile " (" A_Index ") : #" href[2]) 50 | file_indexed[StrReplace(href[1],"/","\")] := true 51 | } 52 | 53 | D(s) { 54 | FileAppend(s "`n", "*") 55 | } -------------------------------------------------------------------------------- /docs/static/source/data_deprecate.js: -------------------------------------------------------------------------------- 1 | deprecateData = { 2 | "Hotstrings.htm#SP":"the default hotstring option SI", 3 | "lib/Send.htm#SendPlay":"SendInput", 4 | "lib/Send.htm#SendPlayDetail":"SendInput", 5 | "lib/SendMode.htm#Play":"the default mode Input" 6 | }; 7 | -------------------------------------------------------------------------------- /docs/static/source/data_translate.js: -------------------------------------------------------------------------------- 1 | translateData = { 2 | // sidebar 3 | "C̲ontent":true, 4 | "Content tab":true, 5 | "Shortcut: ALT+C":true, 6 | "In̲dex":true, 7 | "Index tab":true, 8 | "Shortcut: ALT+N":true, 9 | "Filter":true, 10 | "Directives":true, 11 | "Built-in Variables":true, 12 | "Built-in Functions":true, 13 | "function":true, 14 | "Control Flow Statements":true, 15 | "Declarations":true, 16 | "Operators":true, 17 | "operator":true, 18 | "Built-in Classes":true, 19 | "class":true, 20 | "Built-in Methods/Properties":true, 21 | "Ahk2Exe Compiler":true, 22 | "S̲earch":true, 23 | "Search tab":true, 24 | "Shortcut: ALT+S":true, 25 | "Search":true, 26 | "Highlight keywords":true, 27 | "Go to previous/next occurrence":true, 28 | "Quick reference":true, 29 | "Collapse or uncollapse the quick reference":true, 30 | // header 31 | "Skip navigation":true, 32 | "Hide or show the sidebar":true, 33 | "Go to the homepage":true, 34 | "en":true, 35 | "Change the language":true, 36 | "v1":"v2", 37 | "Change the version":true, 38 | "Edit this document on GitHub":true, 39 | "https://github.com/Lexikos/AutoHotkey_L-Docs/edit/v1/docs/":"https://github.com/Lexikos/AutoHotkey_L-Docs/edit/v2/docs/", 40 | "Go back":true, 41 | "Go forward":true, 42 | "Change the font size":true, 43 | "Print this document":true, 44 | "Open this document in the default browser (requires internet connection). Middle-click to copy the link address.":true, 45 | "Use the dark or light theme":true, 46 | "Open the help settings":true, 47 | // ALT+... shortcuts (needs uppercase) 48 | "C":true, 49 | "N":true, 50 | "S":true, 51 | // content 52 | "Select code":true, 53 | "Download code":true, 54 | "Back to top":true, 55 | "Applies to:\nAutoHotkey_L Revision {0} and later\nAutoHotkey v1.0.90.00 and later":true, 56 | "Applies to AutoHotkey {0} and later":true, 57 | "Deprecated. New scripts should use {0} instead.":true 58 | }; 59 | --------------------------------------------------------------------------------