background preloader

Autohotkey

Facebook Twitter

GUI. Gui, sub-command [, Param2, Param3, Param4] Table of Contents Add: Creates a control such as text, button, or checkbox. Show: Displays the window. It can also minimize, maximize, or move the window. Submit: Saves the user's input and optionally hides the window. Gui, Add, ControlType [, Options, Text] Adds a control to a GUI window (first creating the GUI window itself, if necessary). ControlType is one of the following: For example: Gui, Add, Text,, Please enter your name: Gui, Add, Edit, vName Gui, Show Gui, Show [, Options, Title] Unless otherwise specified in Options, this command makes the window visible, unminimizes it (if necessary), activates it, and sets its title.

Omit the X, Y, W, and H options below to have the window retain its previous size and position. Zero or more of the following strings may be present in Options (specify each number as decimal, not hexadecimal): Hn: Specify for n the height of the window's client area, in pixels. One of the following may also be present: Tips N Tricks. FAQ. Language Syntax Common Tasks Hotkeys, Hotstrings, and Remapping Language Syntax When are quotation marks used with commands and their parameters?

Double quotes (") have special meaning only within expressions. When exactly are variable names enclosed in percent signs? Variable names are always enclosed in percent signs except in cases illustrated in bold below: 1) In parameters that are input or output variables: StringLen, OutputVar, InputVar 2) On the left side of an assignment: Var = 123abc 3) On the left side of traditional (non-expression) if-statements: If Var1 < %Var2% 4) Everywhere in expressions.

When should percent signs and commas be escaped? Literal percent signs must be escaped by preceding them with an accent/backtick. When commas or percent signs are enclosed in quotes within an expression, the accent is permitted but not necessary. Common Tasks Why do some lines in my script never execute? #space:: ; Win+Spacebar Run Notepad WinWaitActive Untitled - Notepad WinMaximize return ^!

The Best Time-Saving AutoHotkey Tricks You Should Be Using. Scripts & Functions. Hotstrings and Auto-replace (similar to AutoText and AutoCorrect) Note: Hotstrings require Windows NT/2000/XP or later. Introduction and Simple Examples Although hotstrings are mainly used to expand abbreviations as you type them (auto-replace), they can also be used to launch any scripted action. In this respect, they are similar to hotkeys except that they are typically composed of more than one character (that is, a string).

To define a hotstring, enclose the triggering abbreviation between pairs of colons as in this example: ::btw::by the way In the above example, the abbreviation btw will be automatically replaced with "by the way" whenever you type it (however, by default you must type an ending character after typing btw, such as a space, period, or enter). The "by the way" example above is known as an auto-replace hotstring because the typed text is automatically erased and replaced by the string specified after the second pair of colons. Ending Characters #Hotstring EndChars -()[]{}:;'"/\,.?!

Options The list below describes each option. ? :b0*? Variables and Expressions. Table of Contents Variables Variable types: AutoHotkey has no explicitly defined variable types. However, a variable containing only digits (with an optional decimal point) is automatically interpreted as a number when a math operation or comparison requires it. (To improve performance, numbers are cached internally to avoid conversions to/from strings.) Variable scope and declarations: With the exception of local variables in functions, all variables are global; that is, their contents may be read or altered by any part of the script. Except where noted on the functions page, variables are not declared; they come into existence simply by using them (and each variable starts off empty/blank).

Variable names: Variable names are not case sensitive (for example, CurrentDate is the same as currentdate). Although a variable name may consist entirely of digits, this is generally used only for incoming command line parameters. MyNumber = 123 MyString = This is a literal string. Expressions Misc. Send/SendRaw/SendInput/SendPlay/SendEvent: Send keys & clicks. Sends simulated keystrokes and mouse clicks to the active window. Send Keys SendRaw Keys SendInput Keys SendPlay Keys SendEvent Keys Parameters Normal mode: When not in raw mode, the following characters are treated as modifiers (these modifiers affect only the very next key): ! +: Sends a SHIFT keystroke. ^: Sends a CONTROL keystroke. #: Sends a WIN keystroke, therefore Send #e would hold down the Windows key and then press the letter "e".

SendInput and SendPlay [v1.0.43+]: SendInput and SendPlay use the same syntax as Send but are generally faster and more reliable. SendEvent [v1.0.43+]: SendEvent sends keystrokes using the same method as the pre-1.0.43 Send command. Key Names: The following table lists the special keys that can be sent (each key name must be enclosed in braces): Repeating or Holding Down a Key To repeat a keystroke: Enclose in braces the name of the key followed by the number of times to repeat it. Send {DEL 4} ; Presses the Delete key 4 times. General Remarks Related. Turn Any Action into a Keyboard Shortcut. Script Showcase. List of Keys and Mouse/Joystick Buttons for Hotkeys and Macros. Mouse (mouse hotkeys require Windows NT/2000/XP or later) LButton - the left mouse button RButton - the right mouse button MButton - the middle or wheel mouse button WheelDown - this is equivalent to rotating the mouse wheel down (toward you) WheelUp - the opposite of the above WheelLeft and WheelRight [v1.0.48+] - these two require a mouse with left/right scrolling capability, but they have no effect on operating systems older than Windows Vista.

(See mouse wheel hotkeys to detect how far the wheel has been turned.) Supported only in Windows 2000/XP or later: XButton1 - a button that appears only on certain mice XButton2 - a button that appears only on certain mice Keyboard Note: The names of the letter and number keys are the same as that single letter or digit. Space - the spacebar Tab Enter (or Return) Escape (or Esc) Backspace (or BS) Delete (or Del) Insert (or Ins) Home End PgUp PgDn Up Down Left Right ScrollLock CapsLock NumLock Help - this probably doesn't exist on most keyboards. Community - Mouse and Keyboard Macros and Hotkeys.

Hotkeys (Mouse, Joystick and Keyboard Shortcuts) Table of Contents Introduction and Simple Examples Hotkeys are sometimes referred to as shortcut keys because of their ability to easily trigger an action (such as launching a program or keyboard macro). In the following example, the hotkey Win+N is configured to launch Notepad. The pound sign [#] stands for the Windows key, which is known as a modifier: #n:: Run Notepad return In the final line above, "return" serves to finish the hotkey. However, if a hotkey needs to execute only a single line, that line can be listed to the right of the double-colon. #n::Run Notepad To use more than one modifier with a hotkey, list them consecutively (the order does not matter)

. ^! You can use the following modifier symbols to define hotkeys: (See the Key List for a complete list of keyboard keys and mouse/joystick buttons) Multiple hotkeys can be stacked vertically to have them perform the same action. A key or key-combination can be disabled for the entire system by having it do nothing. RWin::return ^! ^! Documentation. Alphabetical Command List for AutoHotkey. Tutorial: Macro and Hotkey Creation. This brief introduction will help you start scripting your own macros and hotkeys right away. Tutorial Contents Creating a script Each script is a plain text file containing commands to be executed by the program (AutoHotkey.exe). A script may also contain hotkeys and hotstrings, or even consist entirely of them. However, in the absence of hotkeys and hotstrings, a script will perform its commands sequentially from top to bottom the moment it is launched. To create a new script: Download and install AutoHotkey. In the line above, the first character "#" stands for the Windows key; so #space means holding down the Windows key then pressing the spacebar to activate the hotkey.

Save and close the file. Notes: Multiple scripts can be running simultaneously, each with its own icon in the taskbar notification area. Launching a program or document The Run command is used to launch a program, document, URL, or shortcut. #n::Run Notepad ^! #n:: Run Run Notepad.exe return ^! Send ^c!