├── .gitignore ├── Project.hhp ├── compile_chm.ahk ├── docs ├── 404.htm ├── AHKL_ChangeLog.htm ├── AHKL_DBGPClients.htm ├── AHKL_Features.htm ├── ChangeLogHelp.htm ├── Compat.htm ├── Concepts.htm ├── FAQ.htm ├── Functions.htm ├── HotkeyFeatures.htm ├── Hotkeys.htm ├── Hotstrings.htm ├── KeyList.htm ├── Language.htm ├── Objects.htm ├── Program.htm ├── Scripts.htm ├── Tutorial.htm ├── Variables.htm ├── Welcome.htm ├── index.htm ├── lib │ ├── Asc.htm │ ├── AutoTrim.htm │ ├── Block.htm │ ├── BlockInput.htm │ ├── Break.htm │ ├── Catch.htm │ ├── Chr.htm │ ├── Click.htm │ ├── ClipWait.htm │ ├── ComObjActive.htm │ ├── ComObjArray.htm │ ├── ComObjConnect.htm │ ├── ComObjCreate.htm │ ├── ComObjError.htm │ ├── ComObjFlags.htm │ ├── ComObjGet.htm │ ├── ComObjQuery.htm │ ├── ComObjType.htm │ ├── ComObjValue.htm │ ├── Continue.htm │ ├── Control.htm │ ├── ControlClick.htm │ ├── ControlFocus.htm │ ├── ControlGet.htm │ ├── ControlGetFocus.htm │ ├── ControlGetPos.htm │ ├── ControlGetText.htm │ ├── ControlMove.htm │ ├── ControlSend.htm │ ├── ControlSetText.htm │ ├── CoordMode.htm │ ├── Critical.htm │ ├── DetectHiddenText.htm │ ├── DetectHiddenWindows.htm │ ├── DllCall.htm │ ├── Drive.htm │ ├── DriveGet.htm │ ├── DriveSpaceFree.htm │ ├── Edit.htm │ ├── Else.htm │ ├── Enumerator.htm │ ├── EnvAdd.htm │ ├── EnvDiv.htm │ ├── EnvGet.htm │ ├── EnvMult.htm │ ├── EnvSet.htm │ ├── EnvSub.htm │ ├── EnvUpdate.htm │ ├── Exit.htm │ ├── ExitApp.htm │ ├── File.htm │ ├── FileAppend.htm │ ├── FileCopy.htm │ ├── FileCopyDir.htm │ ├── FileCreateDir.htm │ ├── FileCreateShortcut.htm │ ├── FileDelete.htm │ ├── FileEncoding.htm │ ├── FileExist.htm │ ├── FileGetAttrib.htm │ ├── FileGetShortcut.htm │ ├── FileGetSize.htm │ ├── FileGetTime.htm │ ├── FileGetVersion.htm │ ├── FileInstall.htm │ ├── FileMove.htm │ ├── FileMoveDir.htm │ ├── FileOpen.htm │ ├── FileRead.htm │ ├── FileReadLine.htm │ ├── FileRecycle.htm │ ├── FileRecycleEmpty.htm │ ├── FileRemoveDir.htm │ ├── FileSelectFile.htm │ ├── FileSelectFolder.htm │ ├── FileSetAttrib.htm │ ├── FileSetTime.htm │ ├── Finally.htm │ ├── For.htm │ ├── Format.htm │ ├── FormatTime.htm │ ├── Func.htm │ ├── GetKey.htm │ ├── GetKeyState.htm │ ├── Gosub.htm │ ├── Goto.htm │ ├── GroupActivate.htm │ ├── GroupAdd.htm │ ├── GroupClose.htm │ ├── GroupDeactivate.htm │ ├── Gui.htm │ ├── GuiControl.htm │ ├── GuiControlGet.htm │ ├── GuiControls.htm │ ├── Hotkey.htm │ ├── Hotstring.htm │ ├── IfBetween.htm │ ├── IfEqual.htm │ ├── IfExist.htm │ ├── IfExpression.htm │ ├── IfIn.htm │ ├── IfInString.htm │ ├── IfIs.htm │ ├── IfMsgBox.htm │ ├── IfWinActive.htm │ ├── IfWinExist.htm │ ├── ImageSearch.htm │ ├── InStr.htm │ ├── IniDelete.htm │ ├── IniRead.htm │ ├── IniWrite.htm │ ├── Input.htm │ ├── InputBox.htm │ ├── InputHook.htm │ ├── IsByRef.htm │ ├── IsFunc.htm │ ├── IsLabel.htm │ ├── IsObject.htm │ ├── IsSet.htm │ ├── KeyHistory.htm │ ├── KeyWait.htm │ ├── ListHotkeys.htm │ ├── ListLines.htm │ ├── ListVars.htm │ ├── ListView.htm │ ├── LoadPicture.htm │ ├── Loop.htm │ ├── LoopFile.htm │ ├── LoopParse.htm │ ├── LoopReadFile.htm │ ├── LoopReg.htm │ ├── Math.htm │ ├── Menu.htm │ ├── MenuGetHandle.htm │ ├── MenuGetName.htm │ ├── MouseClick.htm │ ├── MouseClickDrag.htm │ ├── MouseGetPos.htm │ ├── MouseMove.htm │ ├── MsgBox.htm │ ├── NumGet.htm │ ├── NumPut.htm │ ├── ObjAddRef.htm │ ├── ObjBindMethod.htm │ ├── Object.htm │ ├── OnClipboardChange.htm │ ├── OnError.htm │ ├── OnExit.htm │ ├── OnMessage.htm │ ├── Ord.htm │ ├── OutputDebug.htm │ ├── Pause.htm │ ├── PixelGetColor.htm │ ├── PixelSearch.htm │ ├── PostMessage.htm │ ├── Process.htm │ ├── Progress.htm │ ├── Random.htm │ ├── RegDelete.htm │ ├── RegExMatch.htm │ ├── RegExReplace.htm │ ├── RegRead.htm │ ├── RegWrite.htm │ ├── RegisterCallback.htm │ ├── Reload.htm │ ├── Return.htm │ ├── Run.htm │ ├── RunAs.htm │ ├── Send.htm │ ├── SendLevel.htm │ ├── SendMode.htm │ ├── SetBatchLines.htm │ ├── SetControlDelay.htm │ ├── SetDefaultMouseSpeed.htm │ ├── SetEnv.htm │ ├── SetExpression.htm │ ├── SetFormat.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 │ ├── SoundBeep.htm │ ├── SoundGet.htm │ ├── SoundGetWaveVolume.htm │ ├── SoundPlay.htm │ ├── SoundSet.htm │ ├── SoundSetWaveVolume.htm │ ├── SplashTextOn.htm │ ├── SplitPath.htm │ ├── StatusBarGetText.htm │ ├── StatusBarWait.htm │ ├── StrGet.htm │ ├── StrLen.htm │ ├── StrPut.htm │ ├── StrReplace.htm │ ├── StrSplit.htm │ ├── StringCaseSense.htm │ ├── StringGetPos.htm │ ├── StringLeft.htm │ ├── StringLen.htm │ ├── StringLower.htm │ ├── StringMid.htm │ ├── StringReplace.htm │ ├── StringSplit.htm │ ├── StringTrimLeft.htm │ ├── SubStr.htm │ ├── Suspend.htm │ ├── Switch.htm │ ├── SysGet.htm │ ├── Thread.htm │ ├── Throw.htm │ ├── ToolTip.htm │ ├── Transform.htm │ ├── TrayTip.htm │ ├── TreeView.htm │ ├── Trim.htm │ ├── Try.htm │ ├── URLDownloadToFile.htm │ ├── Until.htm │ ├── VarSetCapacity.htm │ ├── VerCompare.htm │ ├── While.htm │ ├── WinActivate.htm │ ├── WinActivateBottom.htm │ ├── WinActive.htm │ ├── WinClose.htm │ ├── WinExist.htm │ ├── WinGet.htm │ ├── WinGetActiveStats.htm │ ├── WinGetActiveTitle.htm │ ├── WinGetClass.htm │ ├── WinGetPos.htm │ ├── WinGetText.htm │ ├── WinGetTitle.htm │ ├── WinHide.htm │ ├── WinKill.htm │ ├── WinMaximize.htm │ ├── WinMenuSelectItem.htm │ ├── WinMinimize.htm │ ├── WinMinimizeAll.htm │ ├── WinMove.htm │ ├── WinRestore.htm │ ├── WinSet.htm │ ├── WinSetTitle.htm │ ├── WinShow.htm │ ├── WinWait.htm │ ├── WinWaitActive.htm │ ├── WinWaitClose.htm │ ├── _AllowSameLineComments.htm │ ├── _ClipboardTimeout.htm │ ├── _CommentFlag.htm │ ├── _ErrorStdOut.htm │ ├── _EscapeChar.htm │ ├── _HotkeyInterval.htm │ ├── _HotkeyModifierTimeout.htm │ ├── _Hotstring.htm │ ├── _If.htm │ ├── _IfTimeout.htm │ ├── _IfWinActive.htm │ ├── _Include.htm │ ├── _InputLevel.htm │ ├── _InstallKeybdHook.htm │ ├── _InstallMouseHook.htm │ ├── _KeyHistory.htm │ ├── _MaxHotkeysPerInterval.htm │ ├── _MaxMem.htm │ ├── _MaxThreads.htm │ ├── _MaxThreadsBuffer.htm │ ├── _MaxThreadsPerHotkey.htm │ ├── _MenuMaskKey.htm │ ├── _NoEnv.htm │ ├── _NoTrayIcon.htm │ ├── _Persistent.htm │ ├── _Requires.htm │ ├── _SingleInstance.htm │ ├── _UseHook.htm │ ├── _Warn.htm │ ├── _WinActivateForce.htm │ └── index.htm ├── license.htm ├── misc │ ├── Acknowledgements.htm │ ├── Ahk2ExeDirectives.htm │ ├── Arrays.htm │ ├── AutoIt2Compat.htm │ ├── CLSID-List.htm │ ├── Clipboard.htm │ ├── DPIScaling.htm │ ├── ErrorLevel.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 │ ├── ContextSensitiveHelp.htm │ ├── ControllerMouse.ahk │ ├── ControllerTest.ahk │ ├── EasyWindowDrag.ahk │ ├── EasyWindowDrag.htm │ ├── EasyWindowDrag_(KDE).ahk │ ├── EasyWindowDrag_(KDE).htm │ ├── EncodeHTML.ahk │ ├── FavoriteFolders.ahk │ ├── FavoriteFolders.htm │ ├── IntelliSense.ahk │ ├── IntelliSense.htm │ ├── JoystickMouse.htm │ ├── JoystickTest.htm │ ├── KeyboardOnScreen.ahk │ ├── KeyboardOnScreen.htm │ ├── MinimizeToTrayMenu.ahk │ ├── MinimizeToTrayMenu.htm │ ├── MouseGestures.htm │ ├── MouseGestures.zip │ ├── MsgBoxButtonNames.ahk │ ├── MsgBoxButtonNames.htm │ ├── Numpad000.ahk │ ├── Numpad000.htm │ ├── NumpadMouse.ahk │ ├── NumpadMouse.htm │ ├── Seek_(SearchTheStartMenu).ahk │ ├── Seek_(SearchTheStartMenu).htm │ ├── TooltipMouseMenu.ahk │ ├── TooltipMouseMenu.htm │ ├── UpDownCustomIncrements.ahk │ ├── VolumeOSD.ahk │ ├── VolumeOSD.htm │ ├── WinLIRC.ahk │ ├── WinLIRC.htm │ ├── WindowShading.ahk │ ├── WindowShading.htm │ └── 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 │ ├── source │ ├── build_search.ahk │ ├── check_data.ahk │ ├── data_deprecate.js │ ├── data_index.js │ ├── data_search.js │ ├── data_toc.js │ └── data_translate.js │ └── theme.css └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | *.chm 2 | # Ignore auto-generated files 3 | Index.hhk 4 | Table of Contents.hhc 5 | -------------------------------------------------------------------------------- /Project.hhp: -------------------------------------------------------------------------------- 1 | [OPTIONS] 2 | Binary Index=No 3 | Compatibility=1.1 or later 4 | Compiled file=AutoHotkey.chm 5 | Default Window=Contents 6 | Default topic=docs\index.htm 7 | Display compile progress=No 8 | Full-text search=Yes 9 | Index file=Index.hhk 10 | Language=0x409 English (United States) 11 | Title=AutoHotkey Help 12 | 13 | [WINDOWS] 14 | Contents="AutoHotkey Help",,,"docs\index.htm","docs\index.htm",,,,,0x73500,,0x10200e,[200,0,1080,700],,,,,3,,0 15 | 16 | 17 | [FILES] 18 | docs\search.htm 19 | docs\settings.htm 20 | docs\static\content.css 21 | docs\static\dark.css 22 | docs\static\ahk_logo.png 23 | docs\static\fonts\icons.eot 24 | docs\static\fonts\icons.svg 25 | docs\static\fonts\icons.ttf 26 | docs\static\fonts\icons.woff 27 | docs\static\highlighter\dark.css 28 | docs\static\highlighter\highlighter.css 29 | docs\static\highlighter\highlighter.js 30 | docs\static\highlighter\light.css 31 | docs\static\source\data_translate.js 32 | docs\static\source\data_search.js 33 | docs\static\source\data_toc.js 34 | docs\static\source\data_index.js 35 | docs\static\source\data_deprecate.js 36 | NUL 37 | 38 | [INFOTYPES] 39 | -------------------------------------------------------------------------------- /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/Welcome.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Welcome to AutoHotkey 8 | 9 | 10 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
32 |

Welcome...

33 | 34 |

Getting Started

35 |

Before AutoHotkey can do anything, you need to write a script telling it what to do.
36 | To learn how, read the tutorial or dive straight in.

37 |

Basically: create a script fileadd some hotkeys → run the script file.

38 |

You can also get help or find many useful scripts on our friendly discussion forum.

39 | 40 |

Why am I seeing this?

41 |
42 |

You ran AutoHotkey without telling it which script file to run, and it couldn't find a script in either of the usual places.

43 |
44 | 45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /docs/lib/Asc.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Asc() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Asc()

15 | 16 |

Returns the numeric value of the first byte or UTF-16 code unit in the specified string.

17 | 18 |
Number := Asc(String)
19 |

Parameters

20 |
21 | 22 |
String
23 |

The string whose numeric value is retrieved.

24 | 25 |
26 | 27 |

Return Value

28 |

This function returns a numeric value in the range 0 to 255 (for ANSI) or 0 to 0xFFFF (for Unicode). See Unicode vs ANSI for details. If String is empty, it returns 0.

29 | 30 |

Remarks

31 |

This function is equivalent to Transform, OutputVar, Asc.

32 |

To allow for Unicode supplementary characters, use Ord(String) instead.

33 | 34 | 35 |

Transform, Ord(), Chr()

36 |

Examples

37 |
38 |

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

39 |
MsgBox, % Asc("t") 
40 | MsgBox, % Asc("test")
41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/lib/Break.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Break - Syntax & Usage | AutoHotkey v1 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 [AHK_L 59+]
20 |
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. LoopLabel must be a constant value - variables and expressions are not supported. If a label is specified, it must point directly at a loop statement.
21 |
22 | 23 |

Remarks

24 |

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

25 | 26 |

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

27 | 28 |

Examples

29 |
30 |

Breaks the loop if var is greater than 25.

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

Breaks the outer loop from within a nested loop.

44 |
outer:
45 | Loop 3
46 | {
47 |     x := A_Index
48 |     Loop 3
49 |     {
50 |         if (x*A_Index = 6)
51 |             break outer  ; Equivalent to break 2 or goto break_outer.
52 |         MsgBox %x%,%A_Index%
53 |     }
54 | }
55 | break_outer: ; For goto.
56 | 
57 |
58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /docs/lib/Chr.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Chr() - Syntax & Usage | AutoHotkey v1 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 |

If Unicode is supported, Number is a Unicode character code between 0 and 0x10FFFF (or 0xFFFF prior to [v1.1.21]); otherwise it is an ANSI character code between 0 and 255.

23 | 24 |
25 | 26 |

Return Value

27 |

This function returns a string corresponding to Number. If Number is not in the valid range of character codes, an empty string is returned.

28 | 29 |

Remarks

30 |

This function supersedes Transform, OutputVar, Chr.

31 |

The meaning of character codes greater than 127 depends on the string encoding in use, which in turn depends on whether a Unicode or ANSI executable is in use.

32 |

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

33 | 34 | 35 |

Transform, Ord(), Asc()

36 | 37 |

Examples

38 |
39 |

Reports the string corresponding to the character code 116.

40 |
MsgBox % Chr(116) ; Reports "t".
41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/lib/ComObjCreate.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ComObjCreate() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

ComObjCreate() [AHK_L 53+]

15 |

Creates a COM object.

16 |
ComObject := ComObjCreate(CLSID , IID)
17 | 18 |

Parameters

19 |
20 | 21 |
CLSID
22 |

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

23 | 24 |
IID
25 |

[v1.0.96.00+]: The identifier of an interface the object supports.

26 | 27 |
28 | 29 |

Return Value

30 |

On failure, the function may throw an exception, exit the script or return an empty string, depending on the current ComObjError() setting and other factors.

31 |

If an IID is specified, an interface pointer is returned. The script must typically call ObjRelease() when it is finished with the pointer.

32 |

Otherwise, a wrapper object usable by script is returned. See object syntax.

33 | 34 | 35 | ComObjGet(), ComObjActive(), ComObjConnect(), ComObjArray(), ComObjError(), ComObjQuery(), CreateObject (Microsoft Docs) 36 | 37 |

Examples

38 |

For a constantly growing list of examples, see the following forum topic: https://www.autohotkey.com/board/topic/56987-.

39 |
40 |

Launches an instance of Internet Explorer, makes it visible and navigates to a website.

41 |
ie := ComObjCreate("InternetExplorer.Application")
42 | ie.Visible := true  ; This is known to work incorrectly on IE7.
43 | ie.Navigate("https://www.autohotkey.com/")
44 | 
45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/lib/ComObjGet.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ComObjGet() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

ComObjGet() [AHK_L 53+]

14 |

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

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

Parameters

18 |
19 | 20 |
Name
21 |

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

22 | 23 |
24 | 25 |

Remarks

26 |

On failure, the function may throw an exception, exit the script or return an empty string, depending on the current ComObjError() setting and other factors.

27 | 28 | 29 | ComObjCreate(), ComObjActive(), ComObjConnect(), ComObjError(), ComObjQuery(), CoGetObject (Microsoft Docs) 30 | 31 |

Examples

32 |
33 |

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

34 |
+Esc::
35 |     WinGet pid, PID, A
36 |     ; Get WMI service object.
37 |     wmi := ComObjGet("winmgmts:")
38 |     ; Run query to retrieve matching process(es).
39 |     queryEnum := wmi.ExecQuery(""
40 |         . "Select * from Win32_Process where ProcessId=" . pid)
41 |         ._NewEnum()
42 |     ; Get first matching process.
43 |     if queryEnum[proc]
44 |         MsgBox 0, Command line, % proc.CommandLine
45 |     else
46 |         MsgBox Process not found!
47 |     ; Free all global objects (not necessary when using local vars).
48 |     wmi := queryEnum := proc := ""
49 | return
50 |
51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/lib/ComObjValue.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ComObjValue() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

ComObjValue() [v1.0.91+]

14 | 15 |

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

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

Parameters

20 |
21 | 22 |
ComObject
23 |

A wrapper object containing a COM object or typed value.

24 | 25 |
26 | 27 |

Return Value

28 |

This function returns a 64-bit signed integer.

29 | 30 |

General Remarks

31 |

This function is not intended for general use.

32 |

Calling ComObjValue is equivalent to variant.llVal, where ComObject 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.

33 | 34 | 35 |

ComObjType(), ComObjCreate(), ComObjGet(), ComObjActive()

36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /docs/lib/DetectHiddenText.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DetectHiddenText - Syntax & Usage | AutoHotkey v1 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 commands such as WinExist() and WinActivate.

16 | 17 |
DetectHiddenText, OnOff
18 |

Parameters

19 |
20 | 21 |
OnOff
22 |
23 |

Specify one of the following words:

24 |

On: Hidden text will be detected.

25 |

Off: Hidden text is not detected.

26 |

[v1.1.30+]: The decimal values 1 and 0 may be used in place of On and Off, respectively.

27 |
28 | 29 |
30 | 31 |

Remarks

32 |

If DetectHiddenText is not used, the default setting is On.

33 |

"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 commands, built-in functions and control flow statements that accept a WinText parameter are affected by this setting, including WinActivate, WinActive(), IfWinActive, WinWait, WinExist(), and IfWinExist.

34 |

The built-in variable A_DetectHiddenText contains the current setting (On or Off).

35 |

Every newly launched thread (such as a hotkey, custom menu item, or timed subroutine) starts off fresh with the default setting for this command. That default may be changed by using this command in the auto-execute section (top part of the script).

36 | 37 |

DetectHiddenWindows

38 |

Examples

39 |
40 |

Turns off the detection of hidden text.

41 |
DetectHiddenText, Off
42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/lib/DriveSpaceFree.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriveSpaceFree - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

DriveSpaceFree

15 | 16 |

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

17 | 18 |
DriveSpaceFree, OutputVar, Path
19 |

Parameters

20 |
21 | 22 |
OutputVar
23 |

The name of the output variable in which to store the result, which is rounded down to the nearest whole number.

24 | 25 |
Path
26 |

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

27 | 28 |
29 | 30 |

Remarks

31 |

OutputVar is set to the amount of free disk space in Megabytes (rounded down to the nearest Megabyte).

32 |

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.

33 | 34 | 35 |

Drive, DriveGet

36 |

Examples

37 |
38 |

Retrieves the free disk space of the C drive and stores it in FreeSpace.

39 |
DriveSpaceFree, FreeSpace, C:\
40 |
41 |
42 |

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

43 |
DriveSpaceFree, FreeSpace, % A_MyDocuments
44 | MsgBox % FreeSpace " MB"
45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/lib/Enumerator.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Enumerator Object - Definition & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Enumerator Object [AHK_L 49+]

14 | 15 |

Allows items in a collection to be enumerated.

16 | 17 |

Table of Contents

18 | 25 | 26 |

Methods

27 |
28 |

Next

29 |

Retrieves the next item or items in an enumeration.

30 |
Boolean := Enum.Next(OutputVar1 , OutputVar2, ...)
31 |

Parameters

32 |
33 |
OutputVar1, OutputVar2
34 |
Receives an implementation-specific value.
35 |
...
36 |
Additional parameters, if supported.
37 |
38 |

Return Value

39 |

This method returns 1 (true) if successful or 0 (false) if there were no items remaining.

40 |

Remarks

41 |

Enumerators returned by ObjNewEnum() are called once for each key-value pair, and allow up to two parameters:

42 | 46 |

Key-value pairs are returned in an implementation-defined order. That is, they are typically not returned in the same order that they were assigned. Existing key-value pairs may be modified during enumeration, but inserting or removing keys may cause some items to be enumerated multiple times or not at all.

47 | 48 |

For-loop, Object._NewEnum()

49 |

Examples

50 |
; Create some sample data.
51 | obj := Object("red", 0xFF0000, "blue", 0x0000FF, "green", 0x00FF00)
52 | 
53 | ; Enumerate!
54 | enum := obj._NewEnum()
55 | While enum[k, v]
56 |     t .= k "=" v "`n"
57 | MsgBox % t
58 | 
59 | ; Requires [AHK_L 59+]
60 | For k, v in obj
61 |     s .= k "=" v "`n"
62 | MsgBox % s
63 | 
64 |
65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /docs/lib/EnvDiv.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | EnvDiv - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

EnvDiv

15 | 16 |

Sets a variable to itself divided by the given value. Synonymous with: Var /= Value.

17 |

Deprecated: This command is not recommended for use in new scripts. Use Var := Var / Value or Var /= Value instead.

18 | 19 |
EnvDiv, Var, Value
20 |

Parameters

21 |
22 | 23 |
Var
24 |

The name of the variable upon which to operate.

25 | 26 |
Value
27 |

Any integer, floating point number, or expression.

28 | 29 |
30 | 31 |

Remarks

32 |

This command is equivalent to the shorthand style: Var /= Value.

33 |

Division by zero will result in an error-message window when the script is loaded (if possible); otherwise it makes the variable blank.

34 |

If either Var or Value is blank or does not start with a number, it is considered to be 0 for the purpose of the calculation (except when used internally in an expression such as Var := X /= Y).

35 |

If either Var or Value contains a decimal point, the end result will be a floating point number in the format set by SetFormat. Otherwise, the result will be truncated (e.g. 19 divided by 10 will yield 1).

36 | 37 |

EnvAdd, EnvSub, EnvMult, SetFormat, Expressions, If Var is [not] Type, SetEnv, bitwise operations (Transform)

38 |

Examples

39 |
40 |

Sets MyCount to itself divided by 2.

41 |
EnvDiv, MyCount, 2
42 |
43 | 44 |
45 |

Equivalent to above.

46 |
MyCount /= 2
47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/lib/EnvGet.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | EnvGet - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

EnvGet [v1.0.43.08+]

14 | 15 |

Retrieves the value of the specified environment variable.

16 | 17 |
EnvGet, OutputVar, EnvVar
18 |

Parameters

19 |
20 | 21 |
OutputVar
22 |

The name of the output variable in which to store the retrieved value.

23 | 24 |
EnvVar
25 |

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

26 | 27 |
28 |

Remarks

29 |

If EnvVar has an empty value or does not exist, OutputVar is made blank.

30 |

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

31 | 32 |

EnvSet, #NoEnv, EnvUpdate, SetEnv, Run / RunWait

33 |

Examples

34 |
35 |

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

36 |
EnvGet, OutputVar, LogonServer
37 |
38 | 39 |
40 |

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

41 |
EnvGet, OutputVar, % A_Is64bitOS ? "ProgramW6432" : "ProgramFiles"
42 | MsgBox, Program files are in: %OutputVar%
43 |
44 | 45 |
46 |

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

47 |
EnvGet, LocalAppData, LocalAppData
48 | MsgBox, %A_UserName%'s Local directory is located at: %LocalAppData%
49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/lib/EnvMult.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | EnvMult - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

EnvMult

15 | 16 |

Sets a variable to itself times the given value. Synonymous with: Var *= Value.

17 |

Deprecated: This command is not recommended for use in new scripts. Use Var := Var * Value or Var *= Value instead.

18 | 19 |
EnvMult, Var, Value
20 |

Parameters

21 |
22 | 23 |
Var
24 |

The name of the variable upon which to operate.

25 | 26 |
Value
27 |

Any integer, floating point number, or expression.

28 | 29 |
30 | 31 |

Remarks

32 |

This command is equivalent to the shorthand style: Var *= Value.

33 |

If either Var or Value is blank or does not start with a number, it is considered to be 0 for the purpose of the calculation (except when used internally in an expression such as Var := X *= Y).

34 |

If either Var or Value contains a decimal point, the end result will be a floating point number in the format set by SetFormat.

35 | 36 |

EnvAdd, EnvSub, EnvDiv, SetFormat, Expressions, If Var is [not] Type, SetEnv, bitwise operations (Transform)

37 |

Examples

38 |
39 |

Sets MyCount to itself times 2.

40 |
EnvMult, MyCount, 2
41 |
42 | 43 |
44 |

Equivalent to above.

45 |
MyCount *= 2
46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/lib/EnvSet.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | EnvSet - Syntax & Usage | AutoHotkey v1 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 |
The name of the environment variable, e.g. Path.
23 | 24 |
Value
25 |

The value to write.

26 | 27 |
28 |

Error Handling

29 |

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

30 |

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

31 |

Remarks

32 |

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

33 |

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

34 |

This command exists separately from SetEnv 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.

35 | 36 |

EnvGet, #NoEnv, EnvUpdate, SetEnv, Run / RunWait

37 |

Examples

38 |
39 |

Writes some text to an environment variable.

40 |
EnvSet, AutGUI, Some text to put in the environment variable.
41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/lib/EnvUpdate.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | EnvUpdate - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

EnvUpdate

15 | 16 |

Notifies the OS and all running applications that environment variable(s) have changed.

17 | 18 |
EnvUpdate
19 |

Error Handling

20 |

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

21 |

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

22 |

Remarks

23 |

Refreshes the OS environment. Similar effect as logging off and then on again.

24 |

For example, after making changes to the following registry key via RegWrite, EnvUpdate could be used to broadcast the change:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment

25 | 26 |

EnvGet, EnvSet, #NoEnv, SetEnv

27 |

Examples

28 |
29 |

Refreshes the OS environment.

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

Exit

14 | 15 |

Exits the current thread or (if the script is not persistent) the entire script.

16 | 17 |
Exit , ExitCode
18 |

Parameters

19 |
20 | 21 |
ExitCode
22 |

If blank or omitted, it defaults to 0 (zero is traditionally used to indicate success). Otherwise, specify an integer between -2147483648 and 2147483647 (can be an expression) 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.

23 | 24 |
25 | 26 |

Remarks

27 |

If the script is not persistent, Exit will attempt to terminate the entire script as though ExitApp was called.

28 |

If the script is not terminated, the Exit command terminates the current thread. In other words, the stack of subroutines called directly or indirectly by a menu, timer, or hotkey subroutine will all be returned from as though a Return were immediately encountered in each. If used directly inside such a subroutine -- rather than in one of the subroutines called indirectly by it -- Exit is equivalent to Return.

29 |

Use ExitApp to completely terminate a script that is persistent.

30 | 31 | 32 |

ExitApp, OnExit, Functions, Gosub, Return, Threads, #Persistent

33 |

Examples

34 |
35 |

In this example, the Exit command terminates the Sub2 subroutine as well as the calling subroutine.

36 |
#z::
37 | Gosub, Sub2
38 | MsgBox, This MsgBox will never happen because of the EXIT.
39 | return
40 | 
41 | Sub2:
42 | Exit  ; Terminate this subroutine as well as the calling subroutine.
43 |
44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/lib/ExitApp.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ExitApp - Syntax & Usage | AutoHotkey v1 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 |

If blank or omitted, it defaults to 0 (zero is traditionally used to indicate success). Otherwise, specify an integer between -2147483648 and 2147483647 (or in [v1.0.48.01+] an expression) 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.

23 | 24 |
25 | 26 |

Remarks

27 |

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

28 |

Any function or subroutine registered by OnExit will be called automatically, and may prevent the script from terminating. In such a case, the current thread exits as if Exit was called.

29 |

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.

30 | 31 | 32 |

Exit, OnExit, #Persistent

33 | 34 |

Examples

35 |
36 |

Press a hotkey to terminate the script.

37 |
#x::ExitApp  ; Win+X
38 |
39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/lib/FileCreateDir.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FileCreateDir - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

FileCreateDir

15 | 16 |

Creates a folder.

17 | 18 |
FileCreateDir, DirName
19 |

Parameters

20 |
21 | 22 |
DirName
23 |
24 |

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

25 |

[v1.1.35+]: Forward slashes (/) and double period (..) are supported.

26 |
27 | 28 |
29 |

Error Handling

30 |

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

31 |

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

32 |

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

33 |

Remarks

34 |

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

35 | 36 |

FileRemoveDir

37 |

Examples

38 |
39 |

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

40 |
FileCreateDir, C:\Test1\My Images\Folder2
41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/lib/FileDelete.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FileDelete - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

FileDelete

14 | 15 |

Deletes one or more files permanently.

16 | 17 |
FileDelete, FilePattern
18 |

Parameters

19 |
20 | 21 |
FilePattern
22 |

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.

23 |

To remove an entire folder, along with all its sub-folders and files, use FileRemoveDir.

24 | 25 |
26 | 27 |

Error Handling

28 |

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

29 |

ErrorLevel is set to the number of files that failed to be deleted (if any) or 0 otherwise. Deleting a wildcard pattern such as *.tmp is considered a success even if it does not match any files; thus ErrorLevel is set to 0.

30 |

If files were found, A_LastError is set to 0 (zero) or the result of the operating system's GetLastError() function immediately after the last failure. Otherwise A_LastError contains an error code that might indicate why no files were found.

31 | 32 |

Remarks

33 |

To send a file to the recycle bin, use the FileRecycle command.

34 |

To delete a read-only file, first remove the read-only attribute. For example: FileSetAttrib, -R, C:\My File.txt.

35 | 36 |

FileRecycle, FileRemoveDir, FileCopy, FileMove

37 |

Examples

38 |
39 |

Deletes all .tmp files in a directory.

40 |
FileDelete, C:\temp files\*.tmp
41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/lib/FileGetVersion.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FileGetVersion - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

FileGetVersion

14 | 15 |

Retrieves the version of a file.

16 | 17 |
FileGetVersion, OutputVar , Filename
18 |

Parameters

19 |
20 | 21 |
OutputVar
22 |

The name of the output variable in which to store the version number/string.

23 | 24 |
Filename
25 |

If blank or 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 command uses the search sequence specified by the system LoadLibrary function.

26 | 27 |
28 | 29 |

Error Handling

30 |

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

31 |

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

32 |

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

33 | 34 |

Remarks

35 |

Most non-executable files (and even some EXEs) won't have a version, and thus OutputVar will be blank in these cases.

36 | 37 |

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

38 |

Examples

39 |
40 |

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

41 |
FileGetVersion, Version, C:\My Application.exe
42 |
43 | 44 |
45 |

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

46 |
FileGetVersion, Version, %A_ProgramFiles%\AutoHotkey\AutoHotkey.exe
47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /docs/lib/FileRecycle.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FileRecycle - Syntax & Usage | AutoHotkey v1 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 |

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.

23 |

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

24 | 25 |
26 | 27 |

Error Handling

28 |

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

29 |

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

30 |

Remarks

31 |

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

32 |

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

33 | 37 | 38 |

FileRecycleEmpty, FileDelete, FileCopy, FileMove

39 |

Examples

40 |
41 |

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

42 |
FileRecycle, C:\temp files\*.tmp
43 |
44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/lib/FileRecycleEmpty.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FileRecycleEmpty - Syntax & Usage | AutoHotkey v1 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 |

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

23 | 24 |
25 | 26 |

Error Handling

27 |

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

28 |

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

29 |

Remarks

30 |

This commands requires that MS Internet Explorer 4 or later be installed.

31 | 32 |

FileRecycle, FileDelete, FileCopy, FileMove

33 |

Examples

34 |
35 |

Empties the recycle bin of the C drive.

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

FileRemoveDir

15 | 16 |

Deletes a folder.

17 | 18 |
FileRemoveDir, DirName , Recurse
19 |

Parameters

20 |
21 | 22 |
DirName
23 |

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

24 | 25 |
Recurse
26 |
27 |

If blank or omitted, it defaults to 0. Otherwise, specify one of the following numbers to indicate whether to recurse into subdirectories:

28 |

0: Do not remove files and sub-directories contained in DirName. In this case, if DirName is not empty, no action will be taken and ErrorLevel will be set to 1.

29 |

1: Remove all files and subdirectories (like the Windows command "rmdir /S").

30 |

This parameter can be an expression, even one that evaluates to 1, 0 or an empty string.

31 |
32 | 33 |
34 |

Error Handling

35 |

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

36 |

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

37 | 38 | 39 |

FileCreateDir, FileDelete

40 |

Examples

41 |
42 |

Removes the directory, but only if it is empty.

43 |
FileRemoveDir, C:\Download Temp
44 |
45 | 46 |
47 |

Removes the directory including its files and subdirectories.

48 |
FileRemoveDir, C:\Download Temp, 1
49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/lib/GetKey.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GetKeyName() / GetKeyVK() / GetKeySC() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

GetKeyName() / GetKeyVK() / GetKeySC() [v1.1.01+]

15 | 16 |

Retrieves the name/text, virtual key code or scan code of a key.

17 | 18 |
19 | String := GetKeyName(Key)
20 | Number := GetKeyVK(Key)
21 | Number := GetKeySC(Key)
22 | 
23 |

Parameters

24 |
25 | 26 |
Key
27 |

A VK or SC code, such as "vkA2" or "sc01D", a combination of both, or a key name. For example, both GetKeyName("vk1B") and GetKeyName("Esc") return Escape, while GetKeyVK("Esc") returns 27. Note that VK and SC codes must be in hexadecimal. To convert a decimal number to the appropriate format, use Format("vk{:x}", vk_code) or Format("sc{:x}", sc_code).

28 | 29 |
30 | 31 |

Return Value

32 |

These functions return the name, virtual key code or scan code of Key.

33 | 34 | 35 |

GetKeyState, Key List, Format()

36 |

Examples

37 |
38 |

Reports information for a specific key.

39 |
key  := "LWin" ; Any key can be used here.
40 | 
41 | name := GetKeyName(key)
42 | vk   := GetKeyVK(key)
43 | sc   := GetKeySC(key)
44 | 
45 | MsgBox, % Format("Name:`t{}`nVK:`t{:X}`nSC:`t{:X}", name, vk, sc)
46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/lib/Goto.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Goto - Syntax & Usage | AutoHotkey v1 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 |

Parameters

19 |
20 | 21 |
Label
22 |

The name of the label to which to jump.

23 | 24 |
25 | 26 |

Remarks

27 |

When using a dynamic label such as %MyLabel%, an error dialog will be displayed if the label does not exist. To avoid this, call IsLabel() beforehand. For example:

28 |
if IsLabel(VarContainingLabelName)
29 |     Goto %VarContainingLabelName%
30 |

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.

31 | 32 |

Gosub, Return, IsLabel(), Else, Blocks, Break, Continue, A_ThisLabel

33 |

Examples

34 |
35 |

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

36 |
Goto, MyLabel
37 | ; ...
38 | MyLabel:
39 | Sleep, 100
40 | ; ...
41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/lib/GroupDeactivate.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GroupDeactivate - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

GroupDeactivate

14 | 15 |

Similar to GroupActivate except activates the next window not in the group.

16 | 17 |
GroupDeactivate, GroupName , Mode
18 |

Parameters

19 |
20 | 21 |
GroupName
22 |

The name of the target group, as originally defined by GroupAdd.

23 | 24 |
Mode
25 |
26 |

If blank or omitted, the command activates the oldest non-member window. Otherwise, specify the following letter:

27 |

R: The newest non-member window (the one most recently active) is activated, but only if a member of the group is active when the command is given. "R" is useful in cases where you temporarily switch to working on an unrelated task. When you return to the group via GroupActivate, GroupDeactivate, or GroupClose, the window you were most recently working with is activated rather than the oldest window.

28 |
29 | 30 |
31 | 32 |

Remarks

33 |

GroupDeactivate causes the first window that does not match any of the group's window specifications to be activated. Using GroupDeactivate a second time will activate the next window in the series and so on. Normally, GroupDeactivate is assigned to a hotkey so that this window-traversal behavior is automated by pressing that key.

34 |

This command is useful in cases where you have a collection of favorite windows that are almost always running. By adding these windows to a group, you can use GroupDeactivate to visit each window that isn't one of your favorites and decide whether to close it. This allows you to clean up your desktop much more quickly than doing it manually.

35 |

See GroupAdd for more details about window groups.

36 | 37 |

GroupAdd, GroupActivate, GroupClose

38 |

Examples

39 |
40 |

Activates the oldest window which is not a member of a window group.

41 |
GroupDeactivate, MyFavoriteWindows  ; Visit non-favorite windows to clean up desktop.
42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/lib/IfExist.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IfExist / IfNotExist - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

IfExist / IfNotExist

15 | 16 |

Checks for the existence of a file or folder.

17 |

Deprecated: These commands are not recommended for use in new scripts. Use the FileExist function instead.

18 | 19 |
20 | IfExist, FilePattern
21 | IfNotExist, FilePattern
22 | 
23 |

Parameters

24 |
25 | 26 |
FilePattern
27 |

The path, filename, or file pattern to check. FilePattern is assumed to be in %A_WorkingDir% if an absolute path isn't specified.

28 | 29 |
30 | 31 | 32 |

FileExist(), Blocks, Else, file loops

33 |

Examples

34 |
35 |

Shows a message box if the D drive does exist.

36 |
IfExist, D:\
37 |     MsgBox, The drive exists.
38 |
39 | 40 |
41 |

Shows a message box if at least one text file does exist in a directory.

42 |
IfExist, D:\Docs\*.txt
43 |     MsgBox, At least one .txt file exists.
44 |
45 | 46 |
47 |

Shows a message box if a file does not exist.

48 |
IfNotExist, C:\Temp\FlagFile.txt
49 |     MsgBox, The target file does not exist.
50 |
51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/lib/IfInString.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IfInString / IfNotInString - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

IfInString / IfNotInString

15 | 16 |

Checks if a variable contains the specified string.

17 |

Deprecated: These commands are not recommended for use in new scripts. Use the InStr function instead.

18 | 19 |
20 | IfInString, Var, SearchString
21 | IfNotInString, Var, SearchString
22 | 
23 |

Parameters

24 |
25 | 26 |
Var
27 |

The name of the variable whose contents will be searched for a match.

28 | 29 |
SearchString
30 |

The string to search for. Matching is not case-sensitive unless StringCaseSense has been turned on.

31 | 32 |
33 | 34 |

Remarks

35 |

The built-in variables A_Space and A_Tab contain a single space and a single tab character, respectively, which might be useful when searching for these characters alone.

36 |

Another command can appear on the same line as this one. In other words, both of these are equivalent:

37 |
IfInString, MyVar, abc, Gosub, Process1
38 | IfInString, MyVar, abc
39 |     Gosub, Process1
40 |

However, items other than named commands are not supported on the same line. For example:

41 |
IfInString, MyVar, abc, found := true  ; Invalid.
42 | 43 |

InStr(), RegExMatch(), StringGetPos, StringCaseSense, IfEqual, If Var [not] in/contains MatchList, If Var [not] between Low and High, If Var is [not] Type, Blocks, Else

44 |

Examples

45 |
46 |

Checks whether Haystack contains the substring "abc".

47 |
Haystack := "abcdefghijklmnopqrs"
48 | Needle := "abc"
49 | IfInString, Haystack, %Needle%
50 | {
51 |     MsgBox, The string was found.
52 |     return
53 | }
54 | else
55 |     Sleep, 1
56 |
57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /docs/lib/IfMsgBox.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IfMsgBox - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

IfMsgBox

15 | 16 |

Checks which button was pushed by the user during the most recent MsgBox command.

17 | 18 |
IfMsgBox, ButtonName
19 |

Parameters

20 |
21 | 22 |
ButtonName
23 |

One of the following strings to represent which button the user pressed in the most recent MsgBox command:

24 | 36 |
37 | 38 |
39 | 40 | 41 |

MsgBox

42 |

Examples

43 |
44 |

Shows a yes-no message box which automatically stops execution after 5 seconds. The user can press the "No" button to initiate the stop immediately.

45 |
MsgBox, 4, , Would you like to continue?, 5  ; 5-second timeout.
46 | IfMsgBox, No
47 |     Return  ; User pressed the "No" button.
48 | IfMsgBox, Timeout
49 |     Return ; i.e. Assume "No" if it timed out.
50 | ; Otherwise, continue:
51 | ; ...
52 |
53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /docs/lib/IniDelete.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IniDelete - Syntax & Usage | AutoHotkey v1 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 |

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

23 | 24 |
Section
25 |

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

26 | 27 |
Key
28 |

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

29 | 30 |
31 |

Error Handling

32 |

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

33 |

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

34 |

Remarks

35 |

A standard ini file looks like:

36 |
[SectionName]
37 | Key=Value
38 | 39 |

IniRead, IniWrite, RegDelete

40 |

Examples

41 |
42 |

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

43 |
IniDelete, C:\Temp\myfile.ini, section2, key
44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /docs/lib/IsByRef.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IsByRef() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

IsByRef() [v1.1.01+]

15 | 16 |

Returns a non-zero number if the specified ByRef parameter was supplied with a variable.

17 | 18 |
Boolean := IsByRef(ParameterVar)
19 |

Parameters

20 |
21 | 22 |
ParameterVar
23 |

A reference to the variable. For example: IsByRef(MyParameter).

24 | 25 |
26 | 27 |

Return Value

28 |

This function returns 1 (true) if ParameterVar is a ByRef parameter and the caller supplied a variable; or 0 (false) if ParameterVar is any other kind of variable.

29 | 30 | 31 |

ByRef parameters

32 |

Examples

33 |
34 |

Reports 1 (true) because Param is a ByRef parameter and was supplied with a variable.

35 |
MsgBox, % Function(MyVar)
36 | 
37 | Function(ByRef Param)
38 | {
39 |     return IsByRef(Param)
40 | }
41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/lib/IsFunc.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IsFunc() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

IsFunc() [v1.0.48+]

15 | 16 |

Returns a non-zero number if the specified function exists in the script.

17 | 18 |
MinParamsPlus1 := IsFunc(FunctionName)
19 |

Parameters

20 |
21 | 22 |
FunctionName
23 |

The name of the function whose minimum number of parameters is retrieved. FunctionName must exist explicitly in the script. In [v1.1.00+], FunctionName can be a function reference instead of a name.

24 | 25 |
26 | 27 |

Return Value

28 |

This function returns one plus the minimum number of parameters (e.g. 1 for a function that requires zero parameters, 2 for a function that requires 1 parameter, etc.). If FunctionName does not exist explicitly in the script (by means such as #Include or a non-dynamic call to a library function), it returns 0.

29 | 30 | 31 |

Dynamically Calling a Function, Function References, Func Object, Func(), A_ThisFunc

32 |

Examples

33 |
34 |

Reports the number of mandatory parameters of a function.

35 |
count := IsFunc("RegExReplace") ; Any function name can be used here.
36 | if count
37 |     MsgBox, % "This function exists and has " count-1 " mandatory parameters."
38 | else
39 |     MsgBox, % "This function does not exist."
40 |
41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/lib/IsLabel.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IsLabel() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

IsLabel()

14 | 15 |

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

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

Parameters

19 |
20 | 21 |
LabelName
22 |

The name of a subroutine, hotkey, or hotstring. The trailing colon(s) should not be included.

23 | 24 |
25 | 26 |

Return Value

27 |

This function returns 1 (true) if LabelName exists in the script, otherwise 0 (false).

28 | 29 |

Remarks

30 |

This function is useful to avoid runtime errors when specifying a dynamic label in commands such as Gosub, Hotkey, Menu, and Gui.

31 | 32 |

Labels

33 |

Examples

34 |
35 |

Reports "Subroutine exists" because the subroutine does exist.

36 |
if IsLabel("Label")
37 |     MsgBox, Subroutine exists
38 | else
39 |     MsgBox, Subroutine doesn't exist
40 | 
41 | Label:
42 | return
43 |
44 | 45 |
46 |

Reports "Hotkey exists" because the hotkey does exist.

47 |
if IsLabel("^#h")
48 |     MsgBox, Hotkey exists
49 | else
50 |     MsgBox, Hotkey doesn't exist
51 | 
52 | ^#h::return
53 |
54 | 55 |
56 |

Reports "Hotstring exists" because the hotstring does exist.

57 |
if IsLabel("::btw")
58 |     MsgBox, Hotstring exists
59 | else
60 |     MsgBox, Hotstring doesn't exist
61 | 
62 | ::btw::by the way
63 |
64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /docs/lib/IsObject.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | IsObject() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

IsObject() [v1.0.90+]

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 |

The value to check.

24 |
25 | 26 |
27 | 28 |

Return Value

29 |

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

30 | 31 |

Remarks

32 |

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:

33 | 39 | 40 | 41 |

Objects

42 |

Examples

43 |
44 |

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

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

IsSet() [v1.1.35+]

14 | 15 |

Returns a non-zero number if the specified variable has been assigned a value.

16 | 17 |
Boolean := IsSet(Var)
18 |

Parameters

19 |
20 | 21 |
Var
22 |
23 |

A direct or dynamic variable reference. For example: IsSet(MyVar) or IsSet(%VarContainingName%).

24 |
25 | 26 |
27 | 28 |

Return Value

29 |

This function returns 1 (true) if Var has been assigned a value, otherwise 0 (false).

30 | 31 |

Remarks

32 |

A variable which has not been assigned a value is also known as an uninitialized variable.

33 |

This function is affected by the following technical limitations of AutoHotkey v1.1:

34 | 38 | 39 | 40 |

ByRef parameters

41 |

Examples

42 |
43 |

Shows different uses for IsSet.

44 |
45 | Loop 2
46 |     if !IsSet(MyVar)  ; Is this the first "use" of MyVar?
47 |         MyVar := A_Index  ; Initialize on first "use".
48 | MsgBox % "MyVar is " (IsSet(MyVar) ? "set and has value """ MyVar """" : "unset")
49 | 
50 |
51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/lib/ListHotkeys.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ListHotkeys - Syntax & Usage | AutoHotkey v1 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 command is equivalent to selecting the View->Hotkeys menu item in the main window.

19 |

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

20 |

[v1.1.16+]: 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, #MaxHotkeysPerInterval

34 |

Examples

35 |
36 |

Displays information about the hotkeys used by the current script.

37 |
ListHotkeys
38 |
39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/lib/MenuGetHandle.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MenuGetHandle() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

MenuGetHandle() [v1.1.23+]

15 | 16 |

Retrieves the Win32 menu handle of a menu.

17 |
Handle := MenuGetHandle(MenuName)
18 | 19 |

Parameters

20 |
21 | 22 |
MenuName
23 |

The name of an existing menu. Menu names are not case-sensitive.

24 | 25 |
26 | 27 |

Remarks

28 |

The returned handle is valid only until the Win32 menu is destroyed. Once the menu is destroyed, the operating system may reassign the handle value to any menus subsequently created by the script or any other program. Conditions which can cause the menu to be destroyed are listed under Win32 Menus.

29 | 30 | 31 |

Menu, MenuGetName()

32 | 33 |

Examples

34 |
35 |

Reports the number of items in a menu and the ID of the last item.

36 |
Menu MyMenu, Add, Item 1, no
37 | Menu MyMenu, Add, Item 2, no
38 | Menu MyMenu, Add, Item B, no
39 | 
40 | ; Retrieve the number of items in a menu.
41 | item_count := DllCall("GetMenuItemCount", "ptr", MenuGetHandle("MyMenu"))
42 | 
43 | ; Retrieve the ID of the last item.
44 | last_id := DllCall("GetMenuItemID", "ptr", MenuGetHandle("MyMenu"), "int", item_count-1)
45 | 
46 | MsgBox, MyMenu has %item_count% items, and its last item has ID %last_id%.
47 | 
48 | no:
49 | return
50 | 
51 |
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /docs/lib/MenuGetName.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MenuGetName() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

MenuGetName() [v1.1.23+]

15 | 16 |

Retrieves the name of a menu given a handle to its underlying Win32 menu.

17 |
MenuName := MenuGetName(Handle)
18 | 19 |

Parameters

20 |
21 | 22 |
Handle
23 |

A Win32 menu handle (HMENU).

24 | 25 |
26 | 27 |

Remarks

28 |

Only the menu's current handle is recognized. When the menu's underlying Win32 menu is destroyed and recreated, the handle changes. For details, see Win32 Menus.

29 | 30 | 31 |

Menu, MenuGetHandle()

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

ObjAddRef() / ObjRelease() [AHK_L 53+]

15 | 16 |

Increments or decrements an object's reference count.

17 | 18 |
ObjAddRef(Ptr)
19 | ObjRelease(Ptr)
20 | 21 |

Parameters

22 |
23 | 24 |
Ptr
25 |

An unmanaged object pointer or COM interface pointer.

26 | 27 |
28 | 29 |

Return Value

30 |

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

31 | 32 | 33 |

Reference Counting

34 |

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.

35 | 36 |

Examples

37 |
38 |

Retrieves the pointer of an object and increments the reference count. For details, see Pointers to Objects.

39 |
obj := Object()
40 | 
41 | ; The following two lines are equivalent:
42 | ptr1 := Object(obj)
43 | ptr2 := ObjectToPointer(obj)
44 | 
45 | ObjectToPointer(obj) {
46 |     if !IsObject(obj)
47 |         return ""
48 |     ptr := &obj
49 |     ObjAddRef(ptr)
50 |     return ptr
51 | }
52 | 
53 | ; Each pointer retrieved via Object() or ObjectToPointer() must be manually released
54 | ; to allow the object to be eventually freed and any memory used by it reclaimed.
55 | ObjRelease(ptr2)
56 | ObjRelease(ptr1)
57 | 
58 |
59 | 60 |

For another example, see ComObjConnect().

61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /docs/lib/ObjBindMethod.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ObjBindMethod() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

ObjBindMethod() [v1.1.20+]

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 |

Any object.

24 | 25 |
Method
26 |

A method name.

27 | 28 |
Params
29 |

Any number of parameters.

30 | 31 |
32 | 33 |

Remarks

34 |

For details and examples, see BoundFunc object.

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

Ord() [v1.1.21+]

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 |

The string whose ordinal value is retrieved.

23 | 24 |
25 | 26 |

Return Value

27 |

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.

28 | 29 |

Remarks

30 |

Apart from the Unicode supplementary character detection, this function is identical to Asc().

31 | 32 | 33 |

Asc(), Chr()

34 |

Examples

35 |
36 |

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

37 |
MsgBox, % Ord("t") 
38 | MsgBox, % Ord("test")
39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/lib/OutputDebug.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OutputDebug - Syntax & Usage | AutoHotkey v1 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 |

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.

23 | 24 |
25 | 26 |

Remarks

27 |

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

28 |

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

29 |

See also: other debugging methods

30 | 31 |

FileAppend, continuation sections

32 |

Examples

33 |
34 |

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

35 |
OutputDebug, %A_Now%: Because the window "%TargetWindowTitle%" did not exist, the process was aborted.
36 |
37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/lib/Shutdown.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Shutdown - Syntax & Usage | AutoHotkey v1 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 |

A combination (sum) of the following numbers:

24 | 31 |

Add the required values together. For example, to shutdown and power down the flag would be 9 (shutdown + power down = 1 + 8 = 9). Alternatively, an expression such as 1+8 can be specified.

32 |

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.

33 |

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

34 |
35 | 36 |
37 | 38 |

Remarks

39 |

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

40 |

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

41 |

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

42 | 43 |

Run, ExitApp, OnExit

44 |

Examples

45 |
46 |

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

47 |
Shutdown, 6
48 |
49 | 50 |
51 |

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.

52 |
; Parameter #1: Pass 1 instead of 0 to hibernate rather than suspend.
53 | ; Parameter #2: Pass 1 instead of 0 to suspend immediately rather than asking each application for permission.
54 | ; Parameter #3: Pass 1 instead of 0 to disable all wake events.
55 | DllCall("PowrProf\SetSuspendState", "Int", 0, "Int", 0, "Int", 0)
56 |
57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /docs/lib/SoundBeep.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SoundBeep - Syntax & Usage | AutoHotkey v1 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 |

If blank or omitted, it defaults to 523. Otherwise, specify the frequency of the sound, a number between 37 and 32767, which can be an expression.

23 | 24 |
Duration
25 |

If blank or omitted, it defaults to 150. Otherwise, specify the duration of the sound, in milliseconds, which can be an expression.

26 | 27 |
28 | 29 |

Remarks

30 |

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

31 |

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

32 |

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

33 | 34 |

SoundPlay

35 |

Examples

36 |
37 |

Plays the default pitch and duration.

38 |
SoundBeep
39 |
40 | 41 |
42 |

Plays a higher pitch for half a second.

43 |
SoundBeep, 750, 500
44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/lib/SoundGetWaveVolume.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SoundGetWaveVolume - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

SoundGetWaveVolume

15 | 16 |

Retrieves the wave output volume of a sound device.

17 | 18 |
SoundGetWaveVolume, OutputVar , DeviceNumber
19 |

Parameters

20 |
21 | 22 |
OutputVar
23 |

The name of the output variable in which to store the retrieved volume level, which is a floating point number between 0 and 100 inclusive. The variable will be made blank if there was a problem retrieving the volume. The format of the floating point number, such as its decimal places, is determined by SetFormat.

24 | 25 |
DeviceNumber
26 |

If blank or omitted, it defaults to 1 (the first sound device), which is usually the system's default device for recording and playback. Otherwise, specify a number higher than 1 to operate upon a different sound device.

27 | 28 |
29 |

Error Handling

30 |

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

31 |

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

32 |

Remarks

33 |

The current wave output volume level can be set via SoundSetWaveVolume. Settings such as Master Volume, Synth, Microphone, Mute, Treble, and Bass can be set and retrieved using SoundSet and SoundGet.

34 |

[v1.1.10+]: On Windows Vista and later, this command is equivalent to SoundGet, OutputVar, Wave, Volume.

35 | 36 |

SoundSetWaveVolume, SoundSet, SoundGet, SoundPlay

37 |

Examples

38 |
39 |

Retrieves and reports the current wave output volume.

40 |
SoundGetWaveVolume, OutputVar
41 | MsgBox, The current wave output volume level is %OutputVar%`%.
42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/lib/StrLen.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | StrLen() - Syntax & Usage | AutoHotkey v1 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 |
The string whose contents will be measured.
21 |
22 | 23 |

Return Value

24 |

This function returns the length of the string.

25 | 26 |

Remarks

27 |

If String is a variable to which ClipboardAll was previously assigned, StrLen() will retrieve its total size.

28 | 29 | 30 |

StringLen, InStr(), SubStr(), Trim(), StringLower, StringUpper, StrPut(), StrGet(), StrReplace(), StrSplit()

31 | 32 |

Examples

33 |
34 |

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

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

StringLen

15 |

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

16 |

Deprecated: This command is not recommended for use in new scripts. Use the StrLen function instead.

17 |
StringLen, OutputVar, InputVar
18 | 19 |

Parameters

20 |
21 | 22 |
OutputVar
23 |
The name of the output variable in which to store the length.
24 | 25 |
InputVar
26 |
The name of the input variable whose contents will be measured. Do not enclose the name in percent signs unless you want the contents of the variable to be used as the name.
27 | 28 |
29 | 30 |

Remarks

31 |

For this and all other commands, OutputVar is allowed to be the same variable as InputVar.

32 |

If InputVar is a variable to which ClipboardAll was previously assigned, StringLen will retrieve its total size.

33 | 34 | 35 |

StrLen(), IfInString, StringGetPos, StringMid, StringTrimLeft, StringTrimRight, StringLeft, StringRight, StringLower, StringUpper, StringReplace

36 | 37 |

Examples

38 |
39 |

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

40 |
StrValue := "The quick brown fox jumps over the lazy dog"
41 | StringLen, Length, StrValue
42 | MsgBox, The length of the string is %Length%.
43 |
44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/lib/Trim.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Trim() / LTrim() / RTrim() - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Trim() / LTrim() / RTrim() [AHK_L 31+]

14 | 15 |

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

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

Parameters

23 |
24 | 25 |
String
26 |

Any string value or variable. Numbers are not supported.

27 | 28 |
OmitChars
29 |

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.

30 | 31 |
32 | 33 |

Return Value

34 |

These functions return the trimmed version of the specified string.

35 | 36 |

Examples

37 |
38 |

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

39 |
text := "  text  "
40 | MsgBox % "No trim:`t '" text "'"
41 |     . "`nTrim:`t '" Trim(text) "'"
42 |     . "`nLTrim:`t '" LTrim(text) "'"
43 |     . "`nRTrim:`t '" RTrim(text) "'"
44 |
45 | 46 |
47 |

Trims all zeros from the left side of a string.

48 |
MsgBox % LTrim("00000123", "0")
49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /docs/lib/Until.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Until - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Until [AHK_L 59+]

14 | 15 |

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

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

Parameters

23 |
24 | 25 |
Expression
26 |

Any valid expression.

27 | 28 |
29 | 30 |

Remarks

31 |

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.

32 |

Loop Until is shorthand for the following:

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

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

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

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

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

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

49 | 50 | 51 |

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

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

WinGetActiveStats

15 | 16 |

Combines the functions of WinGetActiveTitle and WinGetPos into one command.

17 | 18 |
WinGetActiveStats, OutTitle, OutWidth, OutHeight, OutX, OutY
19 |

Parameters

20 |
21 | 22 |
OutTitle
23 |

The name of the output variable in which to store the title of the active window.

24 | 25 |
OutWidth, OutHeight
26 |

The names of the output variables in which to store the width and height of the active window.

27 | 28 |
OutX, OutY
29 |

The names of the output variables in which to store the X and Y coordinates of the active window's upper left corner.

30 | 31 |
32 | 33 |

Remarks

34 |

If no matching window is found, the output variables will be made blank.

35 |

This command is equivalent to the following sequence:

36 |
WinGetTitle, OutTitle, A
37 | WinGetPos, OutX, OutY, OutWidth, OutHeight, A
38 |

If the active window is a hidden window and DetectHiddenWindows is off (the default), all commands except WinShow will fail to "see" it. If there is no active window for this reason or any other, this command will set all of its output variables to be blank.

39 | 40 |

WinGetPos, WinGetActiveTitle, WinGetTitle, WinGetClass, WinGetText, ControlGetText

41 |

Examples

42 |
43 |

Retrieves and reports the title, size and position of the active window.

44 |
WinGetActiveStats, Title, Width, Height, X, Y
45 | MsgBox, The active window "%Title%" is %Width% wide`, %Height% tall`, and positioned at %X%`,%Y%.
46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/lib/WinGetActiveTitle.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinGetActiveTitle - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

WinGetActiveTitle

15 | 16 |

Retrieves the title of the active window.

17 | 18 |
WinGetActiveTitle, OutputVar
19 |

Parameters

20 |
21 | 22 |
OutputVar
23 |

The name of the output variable in which to store the title of the active window.

24 | 25 |
26 | 27 |

Remarks

28 |

This command is equivalent to: WinGetTitle, OutputVar, A.

29 | 30 |

WinGetPos, WinGetActiveStats, WinGetTitle, WinGetClass, WinGetText, ControlGetText

31 |

Examples

32 |
33 |

Retrieves and reports the title of the active window.

34 |
WinGetActiveTitle, Title
35 | MsgBox, The active window is "%Title%".
36 |
37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/lib/WinGetClass.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinGetClass - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

WinGetClass

14 | 15 |

Retrieves the specified window's class name.

16 | 17 |
WinGetClass, OutputVar , WinTitle, WinText, ExcludeTitle, ExcludeText
18 |

Parameters

19 |
20 | 21 |
OutputVar
22 |

The name of the output variable in which to store the retrieved class name.

23 | 24 |
WinTitle, WinText, ExcludeTitle, ExcludeText
25 |
26 |

If each of these is blank or omitted, the Last Found Window will be used. 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).

27 |

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.

28 |

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. By default, a window title must start with the specified WinTitle or ExcludeTitle to be a match, unless changed with SetTitleMatchMode.

29 |
30 | 31 |
32 | 33 |

Remarks

34 |

If there is no matching window, OutputVar is made blank.

35 |

For a general explanation of window classes and one way to use them, see ahk_class.

36 |

Only the class name is retrieved (the prefix "ahk_class" is not included in OutputVar).

37 | 38 | 39 |

WinGet, WinGetTitle

40 |

Examples

41 |
42 |

Retrieves and reports the class name of the active window.

43 |
WinGetClass, class, A
44 | MsgBox, The active window's class is "%class%".
45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/lib/WinMinimizeAll.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinMinimizeAll / WinMinimizeAllUndo - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

WinMinimizeAll / WinMinimizeAllUndo

14 | 15 |

Minimizes or unminimizes all windows.

16 | 17 |
18 | WinMinimizeAll
19 | WinMinimizeAllUndo
20 | 
21 |

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

22 | 23 |

WinMinimize, GroupAdd

24 |

Examples

25 |
26 |

Minimizes all windows for 1 second and unminimizes them.

27 |
WinMinimizeAll
28 | Sleep, 1000
29 | WinMinimizeAllUndo
30 |
31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/lib/WinRestore.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinRestore - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

WinRestore

14 | 15 |

Unminimizes or unmaximizes the specified window if it is minimized or maximized.

16 | 17 |
WinRestore , WinTitle, WinText, ExcludeTitle, ExcludeText
18 |

Parameters

19 |
20 | 21 |
WinTitle, WinText, ExcludeTitle, ExcludeText
22 |
23 |

If each of these is blank or omitted, the Last Found Window will be used. 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).

24 |

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.

25 |

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. By default, a window title must start with the specified WinTitle or ExcludeTitle to be a match, unless changed with SetTitleMatchMode.

26 |
27 | 28 |
29 | 30 |

Remarks

31 |

If a particular type of window does not respond correctly to WinRestore, try using the following instead:

32 |
PostMessage, 0x0112, 0xF120,,, WinTitle, WinText  ; 0x0112 = WM_SYSCOMMAND, 0xF120 = SC_RESTORE
33 |

This command operates only upon the topmost matching window except when WinTitle is ahk_group GroupName, in which case all windows in the group are affected.

34 | 35 | 36 |

WinMinimize, WinMaximize

37 |

Examples

38 |
39 |

Unminimizes or unmaximizes Notepad if it is minimized or maximized.

40 |
WinRestore, Untitled - Notepad
41 |
42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /docs/lib/WinShow.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinShow - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

WinShow

14 | 15 |

Unhides the specified window.

16 | 17 |
WinShow , WinTitle, WinText, ExcludeTitle, ExcludeText
18 |

Parameters

19 |
20 | 21 |
WinTitle, WinText, ExcludeTitle, ExcludeText
22 |
23 |

If each of these is blank or omitted, the Last Found Window will be used. 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).

24 |

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.

25 |

Window titles and text are case-sensitive. By default, hidden text elements are detected unless changed with DetectHiddenText. By default, a window title must start with the specified WinTitle or ExcludeTitle to be a match, unless changed with SetTitleMatchMode.

26 |
27 | 28 |
29 | 30 |

Remarks

31 |

By default, WinShow is the only command that can always detect hidden windows. Other commands can detect them only if DetectHiddenWindows has been turned on.

32 |

This command operates only upon the topmost matching window except when WinTitle is ahk_group GroupName, in which case all windows in the group are affected.

33 | 34 |

WinHide, SetTitleMatchMode, DetectHiddenWindows, Last Found Window

35 |

Examples

36 |
37 |

Opens Notepad, waits until it exists, hides it for a short time and unhides it.

38 |
Run, notepad.exe
39 | WinWait, Untitled - Notepad
40 | Sleep, 500
41 | WinHide ; Use the window found by WinWait.
42 | Sleep, 1000
43 | WinShow ; Use the window found by WinWait.
44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /docs/lib/_AllowSameLineComments.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #AllowSameLineComments - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

#AllowSameLineComments

15 | 16 |

[v1.1.09+]: This directive was removed. AutoIt scripts are no longer supported.

17 | 18 |

Only for AutoIt v2 (.aut) scripts: Allows a comment to appear on the same line as a command.

19 | 20 |
#AllowSameLineComments
21 |

Specifying this directive at the top of any AutoIt v2 (.aut) script will enable the use of same-line comments, which are normally disabled for compatibility reasons. If not used at the top of the script, same-line comments are not supported above the point where the directive occurs.

22 |

Like other directives, #AllowSameLineComments cannot be executed conditionally.

23 |

Examples

24 |
25 |

Allows a comment to appear on the same line as a command.

26 |
#AllowSameLineComments
27 | Sleep, 1  ; This comment is a same-line comment.
28 |
29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/lib/_ClipboardTimeout.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #ClipboardTimeout - Syntax & Usage | AutoHotkey v1 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 |

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

23 | 24 |
25 |

Remarks

26 |

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

27 |

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.

28 |

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

29 |

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.

30 |

This directive does not cause the reading of clipboard data to be reattempted if the first attempt fails. Prior to [v1.1.16], it did cause the script to wait until the timeout expired, but in doing so prevented any further data from being retrieved.

31 |

Like other directives, #ClipboardTimeout cannot be executed conditionally.

32 | 33 |

Clipboard, Thread

34 |

Examples

35 |
36 |

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

37 |
#ClipboardTimeout 2000
38 |
39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /docs/lib/_CommentFlag.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #CommentFlag - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

#CommentFlag

15 | 16 |

Changes the script's comment symbol from semicolon to some other string.

17 |

Deprecated: This directive is not recommended for use in new scripts. Use the default comment flag (semicolon) instead.

18 | 19 |
#CommentFlag NewString
20 |

Parameters

21 |
22 | 23 |
NewString
24 |

One or more characters that should be used as the new comment flag. Up to 15 characters may be specified.

25 | 26 |
27 |

Remarks

28 |

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

29 |

The comment flag is used to indicate that text that follows it should not be acted upon by the script (comments are not loaded into memory when a script is launched, so they do not affect performance).

30 |

A comment flag that appears on the same line as a command is not considered to mark a comment unless it has at least one space or tab to its left. For example:

31 |
MsgBox, Test1 ; This is a comment.
32 | MsgBox, Test2; This is not a comment and will be displayed by MsgBox.
33 |

Like other directives, #CommentFlag cannot be executed conditionally.

34 | 35 |

#EscapeChar

36 |

Examples

37 |
38 |

Changes to C++ comment style.

39 |
#CommentFlag //
40 |
41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/lib/_EscapeChar.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #EscapeChar - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

#EscapeChar

15 | 16 |

Changes the script's escape character (e.g. accent vs. backslash).

17 |

Deprecated: This directive is not recommended for use in new scripts. Use the default escape character (accent/backtick) instead.

18 | 19 |
#EscapeChar NewChar
20 |

Parameters

21 |
22 | 23 |
NewChar
24 |

Specify a single character.

25 | 26 |
27 |

Remarks

28 |

The escape character is used to indicate that the character immediately following it should be interpreted differently than it normally would.

29 |

If this directive is unspecified in the script, it will behave as though set to accent/backtick (`), which is at the upper left corner of most English keyboards. Using this character rather than backslash avoids the need for double backslashes in file paths.

30 |

See Escape Sequences for a complete list of sequences and its results (e.g. `n would produce a linefeed character).

31 |

Like other directives, #EscapeChar cannot be executed conditionally.

32 | 33 | 34 |

The following rarely used directives also exist; their usage is shown in these examples:

35 |
#DerefChar #  ; Change it from its normal default, which is %.
36 | #Delimiter /  ; Change it from its normal default, which is comma.
37 |

Deprecated: These directives are not recommended for use in new scripts. Use the default dereference character (percent) and the default delimiter character (comma) instead.

38 |

Examples

39 |
40 |

Changes the default escape character (`) to backslash.

41 |
#EscapeChar \
42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/lib/_HotkeyInterval.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #HotkeyInterval - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

#HotkeyInterval

15 | 16 |

Along with #MaxHotkeysPerInterval, specifies the rate of hotkey activations beyond which a warning dialog will be displayed.

17 | 18 |
#HotkeyInterval Milliseconds
19 |

Parameters

20 |
21 | 22 |
Milliseconds
23 |

The length of the interval in milliseconds.

24 | 25 |
26 |

Remarks

27 |

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

28 |

For details and remarks, see #MaxHotkeysPerInterval.

29 |

Like other directives, #HotkeyInterval cannot be executed conditionally.

30 | 31 |

#MaxHotkeysPerInterval

32 |

Examples

33 |
34 |

Allows a maximum of 200 hotkeys to be pressed within 2000 ms without triggering a warning dialog.

35 |
#HotkeyInterval 2000  ; This is the default value (milliseconds).
36 | #MaxHotkeysPerInterval 200
37 |
38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /docs/lib/_IfTimeout.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #IfTimeout - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

#IfTimeout [AHK_L 8+]

16 | 17 |

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

18 | 19 |
#IfTimeout Timeout
20 |

Parameters

21 |
22 | 23 |
Timeout
24 |

The timeout value to apply globally, in milliseconds.

25 | 26 |
27 | 28 |

Remarks

29 |

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

30 |

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.

31 |

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

32 |

HKEY_CURRENT_USER\Control Panel\Desktop

33 |

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.

34 |

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.

35 |

If a given hotkey has multiple #If 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.

36 |

Like other directives, #IfTimeout cannot be executed conditionally.

37 | 38 |

#If

39 |

Examples

40 |
41 |

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

42 |
#IfTimeout 10
43 |
44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/lib/_InstallMouseHook.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #InstallMouseHook - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

#InstallMouseHook

15 | 16 |

Forces the unconditional installation of the mouse hook.

17 | 18 |
#InstallMouseHook
19 |

Remarks

20 |

The mouse hook monitors mouse clicks for the purpose of activating mouse hotkeys and facilitating hotstrings.

21 |

AutoHotkey does not install the keyboard and mouse hooks unconditionally because together they consume at least 500 KB of memory (but if the keyboard hook is installed, installing the mouse hook only requires about 50 KB of additional memory; and vice versa). Therefore, the mouse hook is normally installed only when the script contains one or more mouse hotkeys. It is also installed for hotstrings, but that can be disabled via #Hotstring NoMouse.

22 |

By contrast, the #InstallMouseHook directive will unconditionally install the mouse hook, which might be useful to allow KeyHistory to monitor mouse clicks.

23 |

You can determine whether a script is using the hook via the KeyHistory command or menu item. You can determine which hotkeys are using the hook via the ListHotkeys command or menu item.

24 |

This directive also makes a script persistent, meaning that ExitApp rather than Exit should be used to terminate it.

25 |

Like other directives, #InstallMouseHook cannot be executed conditionally.

26 | 27 |

#InstallKeybdHook, #UseHook, Hotkey, #Persistent, KeyHistory, GetKeyState, KeyWait

28 |

Examples

29 |
30 |

Installs the mouse hook unconditionally.

31 |
#InstallMouseHook
32 |
33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /docs/lib/_KeyHistory.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #KeyHistory - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

#KeyHistory

15 | 16 |

Sets the maximum number of keyboard and mouse events displayed by the KeyHistory window. You can set it to 0 to disable key history.

17 | 18 |
#KeyHistory MaxEvents
19 |

Parameters

20 |
21 | 22 |
MaxEvents
23 |

The maximum number of keyboard and mouse events displayed by the KeyHistory window (limit 500). Specify 0 to disable key history entirely.

24 | 25 |
26 |

Remarks

27 |

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

28 |

Because this setting is put into effect before the script begins running, it is only necessary to specify it once (anywhere in the script).

29 |

Because each keystroke or mouse click consists of a down-event and an up-event, KeyHistory displays only half as many "complete events" as specified here. For example, if the script contains #KeyHistory 50, up to 25 keystrokes and mouse clicks will be displayed.

30 |

Like other directives, #KeyHistory cannot be executed conditionally.

31 | 32 |

KeyHistory, #NoTrayIcon

33 |

Examples

34 |
35 |

Causes KeyHistory to display the last 100 instead 40 keyboard and mouse events.

36 |
#KeyHistory 100
37 |
38 | 39 |
40 |

Disables key history entirely.

41 |
#KeyHistory 0
42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /docs/lib/_MaxHotkeysPerInterval.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #MaxHotkeysPerInterval - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

#MaxHotkeysPerInterval

15 | 16 |

Along with #HotkeyInterval, specifies the rate of hotkey activations beyond which a warning dialog will be displayed.

17 | 18 |
#MaxHotkeysPerInterval Value
19 |

Parameters

20 |
21 | 22 |
Value
23 |

The maximum number of hotkeys that can be pressed in the interval specified by #HotkeyInterval without triggering a warning dialog.

24 | 25 |
26 |

Remarks

27 |

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

28 |

Care should be taken not to make the above too lenient because if you ever inadvertently introduce an infinite loop of keystrokes (via a Send command that accidentally triggers other hotkeys), your computer could become unresponsive due to the rapid flood of keyboard events.

29 |

As an oversimplified example, the hotkey ^c::Send ^c would produce an infinite loop of keystrokes. To avoid this, add the $ prefix to the hotkey definition (e.g. $^c::) so that the hotkey cannot be triggered by the Send command.

30 |

Like other directives, #MaxHotkeysPerInterval cannot be executed conditionally.

31 | 32 |

#HotkeyInterval

33 |

Examples

34 |
35 |

Allows to press a maximum of 200 instead of 70 hotkeys per interval.

36 |
#MaxHotkeysPerInterval 200
37 |
38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /docs/lib/_MaxMem.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #MaxMem - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

#MaxMem

15 | 16 |

Sets the maximum capacity of each variable to the specified number of megabytes.

17 | 18 |
#MaxMem Megabytes
19 |

Parameters

20 |
21 | 22 |
Megabytes
23 |

The number of megabytes to allow for each variable. A value larger than 4095 is considered to be 4095. A value less than 1 is considered to be 1.

24 | 25 |
26 |

Remarks

27 |

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

28 |

The purpose of limiting each variable's capacity is to prevent a buggy script from consuming all available system memory. Raising or lowering the limit does not affect the performance of a script, nor does it change how much memory the script actually uses (except in the case of WinGetText and ControlGetText, which will be capable of retrieving more text if #MaxMem is increased).

29 |

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.

30 |

This setting restricts only the automatic expansion that a variable does on its own. It does not affect VarSetCapacity().

31 |

Like other directives, #MaxMem cannot be executed conditionally.

32 | 33 |

VarSetCapacity(), Variables, Sort, WinGetText, ControlGetText, #MaxThreads

34 |

Examples

35 |
36 |

Allows 256 MB instead of 64 MB per variable.

37 |
#MaxMem 256
38 |
39 | 40 |
41 |

Allows the maximum amount of MB per variable.

42 |
#MaxMem 4095
43 |
44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /docs/lib/_NoEnv.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #NoEnv - Syntax & Usage | AutoHotkey v1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

#NoEnv [v1.0.43.08+]

15 | 16 |

Avoids checking empty variables to see if they are environment variables (recommended for all new scripts).

17 |
#NoEnv
18 |

Specifying this directive anywhere in a script prevents empty variables from being looked up as potential environment variables. For example:

19 |
#NoEnv
20 | MsgBox %WinDir%
21 |

The above would not retrieve the "WinDir" environment variable (though that could be solved by doing WinDir := A_WinDir near the top of the script).

22 |

Specifying this directive is recommended for all new scripts because:

23 |
    24 |
  1. It significantly improves performance whenever empty variables are used in an expression or command. It also improves the performance of the DllCall function when unquoted parameter types are used (e.g. int vs. "int").
  2. 25 |
  3. It prevents script bugs caused by environment variables whose names unexpectedly match variables used by the script.
  4. 26 |
  5. AutoHotkey v2 will make this behavior the default.
  6. 27 |
28 |

To help ease the transition to #NoEnv, the built-in variables ComSpec and ProgramFiles have been added. They contain the same strings as the corresponding environment variables.

29 |

When #NoEnv is in effect, the script should use EnvGet to retrieve environment variables, or use built-in variables like A_WinDir.

30 |

Like other directives, #NoEnv cannot be executed conditionally.

31 | 32 |

EnvGet, ComSpec, ProgramFiles, A_WinDir

33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /docs/lib/_NoTrayIcon.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #NoTrayIcon - Syntax & Usage | AutoHotkey v1 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 command. 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 using the command Menu, Tray, Icon or Menu, Tray, NoIcon. The only drawback of using Menu, Tray, NoIcon 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.

22 |

Like other directives, #NoTrayIcon cannot be executed conditionally.

23 | 24 |

Tray Icon, Menu, ExitApp

25 |

Examples

26 |
27 |

Causes the script to launch without a tray icon.

28 |
#NoTrayIcon
29 |
30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /docs/lib/_WinActivateForce.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #WinActivateForce - Syntax & Usage | AutoHotkey v1 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 commands 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 v1 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 | if not WinExist("Inbox - Microsoft Outlook")
20 |     return  ; Outlook isn't open to the right section, so do nothing.
21 | WinActivate  ; Activate the window found by the above command.
22 | Send ^n  ; Create new/blank e-mail via Control+N.
23 | WinWaitActive Untitled Message
24 | Send {Tab 2}Product Recall for ACME Rocket Skates  ; Set the subject line.
25 | Send {Tab}Dear Sir or Madam,{Enter 2}We have recently discovered a minor defect ...  ; etc.
26 | return  ; This line serves to finish the hotkey.
27 |

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.

28 |

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

29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/misc/Override.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Overriding or Disabling External Hotkeys | AutoHotkey v1 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::
21 | MsgBox This hotkey is now owned by the script.
22 | return
23 |

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

24 |
#r::return
25 |

Similarly, to disable both Win, use this:

26 |
LWin::return
27 | RWin::return
28 |

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:

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

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.

35 |

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.

36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/misc/Winamp.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Automating Winamp | AutoHotkey v1 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 | if not WinExist("ahk_class Winamp v1.x")
19 |     return
20 | ; Otherwise, the above has set the "last found" window for use below.
21 | ControlSend, ahk_parent, c  ; Pause/Unpause
22 | return
23 |

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:

24 | 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 |
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
74 |

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

75 |
76 | SendMessage, 0x0400, 0, 120,, ahk_class Winamp v1.x
77 | if (ErrorLevel != "FAIL")
78 | {
79 |     ErrorLevel += 1  ; Winamp's count starts at 0, so adjust by 1.
80 |     MsgBox, Track #%ErrorLevel% is active or playing.
81 | }
82 | 83 | 84 | -------------------------------------------------------------------------------- /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 -- 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 command or keyword. If nothing is selected, 5 | ; the command 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 | ; The following values are in effect only for the duration of this hotkey thread. 14 | ; Therefore, there is no need to change them back to their original values 15 | ; because that is done automatically when the thread ends: 16 | SetWinDelay 10 17 | SetKeyDelay 0 18 | AutoTrim, On 19 | 20 | if A_OSType = WIN32_WINDOWS ; Windows 9x 21 | Sleep, 500 ; Give time for the user to release the key. 22 | 23 | C_ClipboardPrev = %clipboard% 24 | clipboard = 25 | ; Use the highlighted word if there is one (since sometimes the user might 26 | ; intentionally highlight something that isn't a command): 27 | Send, ^c 28 | ClipWait, 0.1 29 | if ErrorLevel <> 0 30 | { 31 | ; Get the entire line because editors treat cursor navigation keys differently: 32 | Send, {home}+{end}^c 33 | ClipWait, 0.2 34 | if ErrorLevel <> 0 ; Rare, so no error is reported. 35 | { 36 | clipboard = %C_ClipboardPrev% 37 | return 38 | } 39 | } 40 | C_Cmd = %clipboard% ; This will trim leading and trailing tabs & spaces. 41 | clipboard = %C_ClipboardPrev% ; Restore the original clipboard for the user. 42 | Loop, parse, C_Cmd, %A_Space%`, ; The first space or comma is the end of the command. 43 | { 44 | C_Cmd = %A_LoopField% 45 | break ; i.e. we only need one interation. 46 | } 47 | IfWinNotExist, AutoHotkey Help 48 | { 49 | ; Determine AutoHotkey's location: 50 | RegRead, ahk_dir, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir 51 | if ErrorLevel ; Not found, so look for it in some other common locations. 52 | { 53 | if A_AhkPath 54 | SplitPath, A_AhkPath,, ahk_dir 55 | else IfExist ..\..\AutoHotkey.chm 56 | ahk_dir = ..\.. 57 | else IfExist %A_ProgramFiles%\AutoHotkey\AutoHotkey.chm 58 | ahk_dir = %A_ProgramFiles%\AutoHotkey 59 | else 60 | { 61 | MsgBox Could not find the AutoHotkey folder. 62 | return 63 | } 64 | } 65 | Run %ahk_dir%\AutoHotkey.chm 66 | WinWait AutoHotkey Help 67 | } 68 | ; The above has set the "last found" window which we use below: 69 | WinActivate 70 | WinWaitActive 71 | StringReplace, C_Cmd, C_Cmd, #, {#} 72 | Send, !n{home}+{end}%C_Cmd%{enter} 73 | return 74 | -------------------------------------------------------------------------------- /docs/scripts/ContextSensitiveHelp.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Context Sensitive Help in Any Editor.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/EasyWindowDrag.ahk: -------------------------------------------------------------------------------- 1 | ; Easy Window Dragging (requires XP/2k/NT) 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 | ; This script requires v1.0.25+. 11 | 12 | ~MButton & LButton:: 13 | CapsLock & LButton:: 14 | CoordMode, Mouse ; Switch to screen/absolute coordinates. 15 | MouseGetPos, EWD_MouseStartX, EWD_MouseStartY, EWD_MouseWin 16 | WinGetPos, EWD_OriginalPosX, EWD_OriginalPosY,,, ahk_id %EWD_MouseWin% 17 | WinGet, EWD_WinState, MinMax, ahk_id %EWD_MouseWin% 18 | if EWD_WinState = 0 ; Only if the window isn't maximized 19 | SetTimer, EWD_WatchMouse, 10 ; Track the mouse as the user drags it. 20 | return 21 | 22 | EWD_WatchMouse: 23 | GetKeyState, EWD_LButtonState, LButton, P 24 | if EWD_LButtonState = U ; Button has been released, so drag is complete. 25 | { 26 | SetTimer, EWD_WatchMouse, Off 27 | return 28 | } 29 | GetKeyState, EWD_EscapeState, Escape, P 30 | if EWD_EscapeState = D ; Escape has been pressed, so drag is cancelled. 31 | { 32 | SetTimer, EWD_WatchMouse, Off 33 | WinMove, ahk_id %EWD_MouseWin%,, %EWD_OriginalPosX%, %EWD_OriginalPosY% 34 | return 35 | } 36 | ; Otherwise, reposition the window to match the change in mouse coordinates 37 | ; caused by the user having dragged the mouse: 38 | CoordMode, Mouse 39 | MouseGetPos, EWD_MouseX, EWD_MouseY 40 | WinGetPos, EWD_WinX, EWD_WinY,,, ahk_id %EWD_MouseWin% 41 | SetWinDelay, -1 ; Makes the below move faster/smoother. 42 | WinMove, ahk_id %EWD_MouseWin%,, EWD_WinX + EWD_MouseX - EWD_MouseStartX, EWD_WinY + EWD_MouseY - EWD_MouseStartY 43 | EWD_MouseStartX := EWD_MouseX ; Update for the next timer-call to this subroutine. 44 | EWD_MouseStartY := EWD_MouseY 45 | return 46 | -------------------------------------------------------------------------------- /docs/scripts/EasyWindowDrag.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Easy Window Dragging.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/EasyWindowDrag_(KDE).htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Easy Window Dragging (KDE style).

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/FavoriteFolders.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Easy Access to Favorite Folders.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/IntelliSense.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to IntelliSense.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/JoystickMouse.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Using a Joystick as a Mouse.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/JoystickTest.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Joystick Test Script.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/KeyboardOnScreen.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to On-Screen Keyboard.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/MinimizeToTrayMenu.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Minimize Window to Tray Menu.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/MouseGestures.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Mouse Gestures.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/MouseGestures.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/scripts/MouseGestures.zip -------------------------------------------------------------------------------- /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 IfMsgBox command still requires that the 6 | ; buttons be referred to by their original names. 7 | 8 | #SingleInstance 9 | SetTimer, ChangeButtonNames, 50 10 | MsgBox, 4, Add or Delete, Choose a button: 11 | IfMsgBox, YES 12 | MsgBox, You chose Add. 13 | else 14 | MsgBox, You chose Delete. 15 | return 16 | 17 | ChangeButtonNames: 18 | IfWinNotExist, Add or Delete 19 | return ; Keep waiting. 20 | SetTimer, ChangeButtonNames, Off 21 | WinActivate 22 | ControlSetText, Button1, &Add 23 | ControlSetText, Button2, &Delete 24 | return 25 | -------------------------------------------------------------------------------- /docs/scripts/MsgBoxButtonNames.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Changing MsgBox's Button Names.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /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 | #MaxThreadsPerHotkey 1 10 | ; Above: Use the $ to force the hook to be used, which prevents an 11 | ; infinite loop since this subroutine itself sends Numpad0, which 12 | ; would otherwise result in a recursive call to itself. 13 | SetBatchLines, 100 ; Make it run a little faster in this case. 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 = y 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 = n 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 = y ; 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 = n 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 | return 62 | -------------------------------------------------------------------------------- /docs/scripts/Numpad000.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Numpad 000 Key.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/NumpadMouse.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Using Keyboard Numpad as a Mouse.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/Seek_(SearchTheStartMenu).htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Seek (Search the Start Menu).

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/TooltipMouseMenu.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to ToolTip Mouse Menu.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/VolumeOSD.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Volume On-Screen-Display (OSD).

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/WinLIRC.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to WinLIRC Client.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/scripts/WindowShading.ahk: -------------------------------------------------------------------------------- 1 | ; Window Shading (roll up a window to its title bar) -- 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 | ws_MinHeight = 25 13 | 14 | ; This line will unroll any rolled up windows if the script exits 15 | ; for any reason: 16 | OnExit, ExitSub 17 | return ; End of auto-execute section 18 | 19 | #z:: ; Change this line to pick a different hotkey. 20 | ; Below this point, no changes should be made unless you want to 21 | ; alter the script's basic functionality. 22 | ; Uncomment this next line if this subroutine is to be converted 23 | ; into a custom menu item rather than a hotkey. The delay allows 24 | ; the active window that was deactivated by the displayed menu to 25 | ; become active again: 26 | ;Sleep, 200 27 | WinGet, ws_ID, ID, A 28 | Loop, Parse, ws_IDList, | 29 | { 30 | IfEqual, A_LoopField, %ws_ID% 31 | { 32 | ; Match found, so this window should be restored (unrolled): 33 | StringTrimRight, ws_Height, ws_Window%ws_ID%, 0 34 | WinMove, ahk_id %ws_ID%,,,,, %ws_Height% 35 | StringReplace, ws_IDList, ws_IDList, |%ws_ID% 36 | return 37 | } 38 | } 39 | WinGetPos,,,, ws_Height, A 40 | ws_Window%ws_ID% = %ws_Height% 41 | WinMove, ahk_id %ws_ID%,,,,, %ws_MinHeight% 42 | ws_IDList = %ws_IDList%|%ws_ID% 43 | return 44 | 45 | ExitSub: 46 | Loop, Parse, ws_IDList, | 47 | { 48 | if A_LoopField = ; First field in list is normally blank. 49 | continue ; So skip it. 50 | StringTrimRight, ws_Height, ws_Window%A_LoopField%, 0 51 | WinMove, ahk_id %A_LoopField%,,,,, %ws_Height% 52 | } 53 | ExitApp ; Must do this for the OnExit subroutine to actually Exit the script. 54 | -------------------------------------------------------------------------------- /docs/scripts/WindowShading.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Redirection 9 | 10 | 11 | 12 |

Redirecting to Window Shading.

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/search.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

Searching...

13 | 14 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /docs/static/ahk16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ahk16.png -------------------------------------------------------------------------------- /docs/static/ahk16_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ahk16_pause.png -------------------------------------------------------------------------------- /docs/static/ahk16_pause_suspend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ahk16_pause_suspend.png -------------------------------------------------------------------------------- /docs/static/ahk16_suspend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ahk16_suspend.png -------------------------------------------------------------------------------- /docs/static/ahk_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ahk_logo.png -------------------------------------------------------------------------------- /docs/static/ahk_logo_no_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ahk_logo_no_text.png -------------------------------------------------------------------------------- /docs/static/ahkfile16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ahkfile16.png -------------------------------------------------------------------------------- /docs/static/ctrl_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_button.png -------------------------------------------------------------------------------- /docs/static/ctrl_check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_check.png -------------------------------------------------------------------------------- /docs/static/ctrl_combo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_combo.png -------------------------------------------------------------------------------- /docs/static/ctrl_datetime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_datetime.png -------------------------------------------------------------------------------- /docs/static/ctrl_ddl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_ddl.png -------------------------------------------------------------------------------- /docs/static/ctrl_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_edit.png -------------------------------------------------------------------------------- /docs/static/ctrl_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_group.png -------------------------------------------------------------------------------- /docs/static/ctrl_hotkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_hotkey.png -------------------------------------------------------------------------------- /docs/static/ctrl_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_link.png -------------------------------------------------------------------------------- /docs/static/ctrl_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_list.png -------------------------------------------------------------------------------- /docs/static/ctrl_listview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_listview.png -------------------------------------------------------------------------------- /docs/static/ctrl_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_menu.png -------------------------------------------------------------------------------- /docs/static/ctrl_monthcal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_monthcal.png -------------------------------------------------------------------------------- /docs/static/ctrl_progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_progress.png -------------------------------------------------------------------------------- /docs/static/ctrl_radio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_radio.png -------------------------------------------------------------------------------- /docs/static/ctrl_slider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_slider.png -------------------------------------------------------------------------------- /docs/static/ctrl_status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_status.png -------------------------------------------------------------------------------- /docs/static/ctrl_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_tab.png -------------------------------------------------------------------------------- /docs/static/ctrl_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_text.png -------------------------------------------------------------------------------- /docs/static/ctrl_treeview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_treeview.png -------------------------------------------------------------------------------- /docs/static/ctrl_updown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/ctrl_updown.png -------------------------------------------------------------------------------- /docs/static/dlg_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/dlg_file.png -------------------------------------------------------------------------------- /docs/static/dlg_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/dlg_folder.png -------------------------------------------------------------------------------- /docs/static/dlg_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/dlg_input.png -------------------------------------------------------------------------------- /docs/static/dlg_message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/dlg_message.png -------------------------------------------------------------------------------- /docs/static/dlg_tooltip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/dlg_tooltip.png -------------------------------------------------------------------------------- /docs/static/dlg_traytip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/dlg_traytip.png -------------------------------------------------------------------------------- /docs/static/fonts/icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/fonts/icons.eot -------------------------------------------------------------------------------- /docs/static/fonts/icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/docs/static/fonts/icons.ttf -------------------------------------------------------------------------------- /docs/static/fonts/icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AutoHotkey/AutoHotkeyDocs/746d6b9fe6dc5f933f4690ff5398168c6fa5041c/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>.cmd, 4 | .highlight>.bif { 5 | color: #0148c2; 6 | } 7 | 8 | .highlight>.met { 9 | color: #097f9a; 10 | } 11 | 12 | .highlight>.cfs, 13 | .highlight>.dec { 14 | color: #6F008A; 15 | } 16 | 17 | .highlight>.str { 18 | color: #A31515; 19 | } 20 | 21 | .highlight .str>.esc { 22 | color: #FF0000; 23 | } 24 | 25 | .highlight>.biv, 26 | .highlight>.cls { 27 | color: #006400; 28 | } 29 | 30 | .highlight>.dir { 31 | color: green; 32 | } 33 | 34 | .highlight>.lab, 35 | .highlight>.fun { 36 | font-weight: bold; 37 | color: #290e90; 38 | } 39 | 40 | .highlight .lab>.esc { 41 | color: #0d6bff; 42 | } 43 | 44 | .highlight>.num { 45 | color: #1a6c4e; 46 | } 47 | 48 | .highlight>.cmt { 49 | color: #708090; 50 | } 51 | 52 | .highlight.line-numbers .line-numbers-rows { 53 | border-right-color: #999; 54 | } 55 | 56 | .highlight.line-numbers .line-numbers-rows>span:before { 57 | color: #999; 58 | } 59 | -------------------------------------------------------------------------------- /docs/static/source/check_data.ahk: -------------------------------------------------------------------------------- 1 | ; Requires AutoHotkey v1.1 2 | 3 | SetWorkingDir %A_ScriptDir%\..\.. ; Required. 4 | 5 | if !RegExMatch(A_WorkingDir, "\\docs$") ; Sanity check. 6 | MsgBox 48,, Working dir is not \docs.`n%A_WorkingDir% 7 | 8 | file_indexed := {} 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, "O)\[""(.*?)"",""(.*?)""", 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, "O)\[""(.*?)"",""(.+?)""", 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_LoopFileFullPath 36 | if !file_indexed[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 | FileRead html, % href[1] 45 | if ErrorLevel 46 | D(datafile " (" A_Index ") : " href[1]) 47 | else if href.length() != 1 && !InStr(html, "id=""" href[2] """") 48 | D(datafile " (" A_Index ") : #" href[2]) 49 | file_indexed[StrReplace(href[1],"/","\")] := true 50 | } 51 | 52 | D(s) { 53 | FileAppend %s%`n, * 54 | } -------------------------------------------------------------------------------- /docs/static/source/data_deprecate.js: -------------------------------------------------------------------------------- 1 | deprecateData = { 2 | "lib/_CommentFlag.htm":"the default comment flag (semicolon)", 3 | "lib/_EscapeChar.htm":"the default escape character (accent)", 4 | "lib/_EscapeChar.htm#Delimiter":"the default delimiter character (comma)", 5 | "lib/_EscapeChar.htm#DerefChar":"the default dereference character (percent)", 6 | "lib/ComObjActive.htm#ComObjParameter":"ComObject()", 7 | "lib/ComObjActive.htm#ComObjMissing":"two consecutive commas", 8 | "lib/ComObjActive.htm#ComObjEnwrap":"ComObject() with ObjAddRef()", 9 | "lib/ComObjActive.htm#ComObjEnwrapUnwrap":"ComObject() or ComObjValue() with ObjAddRef()", 10 | "lib/ComObjActive.htm#ComObjUnwrap":"ComObjValue() with ObjAddRef()", 11 | "lib/EnvDiv.htm":"Var /= Value", 12 | "lib/EnvMult.htm":"Var *= Value", 13 | "lib/GetKeyState.htm#command":"GetKeyState()", 14 | "lib/IfEqual.htm":"If (expression)", 15 | "lib/IfExist.htm":"FileExist()", 16 | "lib/IfInString.htm":"InStr()", 17 | "lib/IfWinActive.htm":"WinActive()", 18 | "lib/IfWinExist.htm":"WinExist()", 19 | "lib/OnClipboardChange.htm#label":"OnClipboardChange()", 20 | "lib/OnExit.htm#command":"OnExit()", 21 | "lib/Progress.htm":"Gui", 22 | "lib/SetEnv.htm":"Var := Value", 23 | "lib/SetFormat.htm":"Format()", 24 | "lib/SplashTextOn.htm":"Gui", 25 | "lib/StringGetPos.htm":"InStr()", 26 | "lib/StringLeft.htm":"SubStr()", 27 | "lib/StringLen.htm":"StrLen()", 28 | "lib/StringMid.htm":"SubStr()", 29 | "lib/StringReplace.htm":"StrReplace()", 30 | "lib/StringSplit.htm":"StrSplit()", 31 | "lib/StringTrimLeft.htm":"SubStr()", 32 | "lib/Transform.htm": "math functions and operators", 33 | "lib/Transform.htm#Abs": "Abs()", 34 | "lib/Transform.htm#ACos": "ACos()", 35 | "lib/Transform.htm#Asc": "Asc()", 36 | "lib/Transform.htm#ASin": "ASin()", 37 | "lib/Transform.htm#ATan": "ATan()", 38 | "lib/Transform.htm#BitAnd": "the & operator", 39 | "lib/Transform.htm#BitNot": "the ~ operator", 40 | "lib/Transform.htm#BitOr": "the | operator", 41 | "lib/Transform.htm#BitShiftLeft": "the << operator", 42 | "lib/Transform.htm#BitShiftRight": "the >> operator", 43 | "lib/Transform.htm#BitXOr": "the ^ operator", 44 | "lib/Transform.htm#Ceil": "Ceil()", 45 | "lib/Transform.htm#Chr": "Chr()", 46 | "lib/Transform.htm#Cos": "Cos()", 47 | "lib/Transform.htm#Deref": "the expression syntax or a custom function", 48 | "lib/Transform.htm#Exp": "Exp()", 49 | "lib/Transform.htm#Floor": "Floor()", 50 | "lib/Transform.htm#HTML": "a custom function", 51 | "lib/Transform.htm#Ln": "Ln()", 52 | "lib/Transform.htm#Log": "Log()", 53 | "lib/Transform.htm#Mod": "Mod()", 54 | "lib/Transform.htm#Pow": "the ** operator", 55 | "lib/Transform.htm#Round": "Round()", 56 | "lib/Transform.htm#Sin": "Sin()", 57 | "lib/Transform.htm#Sqrt": "Sqrt()", 58 | "lib/Transform.htm#Tan": "Tan()", 59 | "lib/Transform.htm#Unicode": "the Unicode version of AutoHotkey" 60 | }; 61 | -------------------------------------------------------------------------------- /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 | "Control Flow Statements":true, 14 | "Declarations":true, 15 | "Operators":true, 16 | "Commands":true, 17 | "Sub-commands":true, 18 | "Built-in Methods/Properties":true, 19 | "Ahk2Exe Compiler":true, 20 | "S̲earch":true, 21 | "Search tab":true, 22 | "Shortcut: ALT+S":true, 23 | "Search":true, 24 | "Highlight keywords":true, 25 | "Go to previous/next occurrence":true, 26 | "Quick reference":true, 27 | "Collapse or uncollapse the quick reference":true, 28 | // header 29 | "Skip navigation":true, 30 | "Hide or show the sidebar":true, 31 | "Go to the homepage":true, 32 | "en":true, 33 | "Change the language":true, 34 | "v1":true, 35 | "Change the version":true, 36 | "Edit this document on GitHub":true, 37 | "https://github.com/Lexikos/AutoHotkey_L-Docs/edit/v1/docs/":true, 38 | "Go back":true, 39 | "Go forward":true, 40 | "Change the font size":true, 41 | "Print this document":true, 42 | "Open this document in the default browser (requires internet connection). Middle-click to copy the link address.":true, 43 | "Use the dark or light theme":true, 44 | "Open the help settings":true, 45 | // ALT+... shortcuts (needs uppercase) 46 | "C":true, 47 | "N":true, 48 | "S":true, 49 | // content 50 | "Select code":true, 51 | "Download code":true, 52 | "Back to top":true, 53 | "Applies to:\nAutoHotkey_L Revision {0} and later\nAutoHotkey v1.0.90.00 and later":true, 54 | "Applies to AutoHotkey {0} and later":true, 55 | "Deprecated. New scripts should use {0} instead.":true 56 | }; 57 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Redirecting to docs/.

9 | 10 | --------------------------------------------------------------------------------