This link has been bookmarked by 201 people . It was first bookmarked on 30 Jun 2006, by phy.
-
29 Jun 15
-
1 - The Basics
-
Hotkey
-
is how you SEND keystrokes.
-
It literally STOPS code from going any further, to the lines below
-
10. Hip Hip Hooray! Your first script is done. Go get some reward snacks then return to reading the rest of this tutorial.
-
When you are making your code, you might have the urge to put several commands on the same line or inside of each other, don't. In section 5 we'll talk about why it doesn't work as you might expect and what you can do instead.
-
2 - Hotkeys & Hotstrings
-
It is a key or key combination that the person at the keyboard presses to trigger some actions.
-
hotkey will be triggered when you press
-
hotstring will convert your typed "ftw" into "Free the whales".
-
A hotkey is created by using a single pair of ::'s.
-
pair of ::'s on each side of the text you want to trigger the text replacement
-
Symbol Description # Win (Windows logo key) ! Alt ^ Control + Shift & An ampersand may be used between any two keys or mouse buttons to combine them into a custom hotkey. -
(For the full list of symbols, see the Hotkey page)
-
You can define a custom combination of two (and only two) keys (except joystick buttons) by using & between them.
-
now wondering if hotstrings have any cool modifiers since hotkeys do. Yes, they do!
-
For additional hotkey and hotstring modifiers, information and examples, visit:
-
Sometime you might want a hotkey or hotstring to only work (or be disabled) in a certain window.
-
create context-sensitive hotkeys and hotstrings.
-
"directives"
-
he #IfWin commands are positional: they affect all hotkeys and hotstrings physically beneath them in the script.
-
So I'll set it clear: AutoHotkey has the ability to have as many hotkeys and hotstrings in 1 file as you want. Whether it's 1, or 3253 (or more).
-
s soon as you press an EndChar.
-
without needing an EndChar
-
Send literally sends keystrokes, to simulate typing or pressing of keys.
-
Use the Send command.
-
!: Sends the ALT key. For example, Send This is text!a would send the keys "This is text" and then press ALT+a.
-
!A produces a different effect in some programs than !a.
-
ould hold down the Windows key and then press the letter "e".
-
But in fact they are needed. It's how AHK knows that
{!}means "exclamation point" and not "press the Alt key". -
send, Multiple{enter}lines have{enter}been sent.
-
people think that everything needs to be wrapped in brackets with the send command. That is FALSE.
-
To hold down or release a key, enclose the key name in brackets and then use the word UP or DOWN.
-
how you hold 1 key down and press another key (or keys).
-
Sleep, 1000 ; Keep it down for one second.
-
Use what is known as a Continuation Section
-
everal different forms of send
-
For more information on what each one does
-
has a cheat prevention system and your hotkeys, hotstrings and send commands do not work, you are out of luck.
-
you can use the Run command
-
Command-Line parameters and CLSID.
-
ommands do not use parenthesis "()" around the parameters like functions do
-
You can tell what a command is by looking at its syntax (the way it looks)
-
, you cannot squish other commands onto the same line as a previous command
-
also differ from function in that they use "traditional syntax". Meaning: when you use a
variable, you NEED to use %'s around it.%variable%. -
Additionally, you cannot do math in the parameters, unlike functions().
-
because they use parenthesis
-
Variables do not need to be wrapped in percent signs.
-
Functions can go inside of functions.
-
Commands need an OutputVar parameter, functions do not. The most common way to assign a variable to the value of a function is like so:
-
Exitapp
-
like little post-it notes that hold some information
-
expression
-
In expression mode, variables do not need %'s.
-
One of the most common issues with AutoHotkey involving variables is when to use the percent signs (%)
-
c. other examples?
-
objects are referred to as arrays,
-
collection of variables.
-
numbered list of things
-
-
30 Oct 14
-
10 Sep 14
-
30 Aug 14
-
Each script is a plain text file containing commands to be executed by the program (AutoHotkey.exe)
-
-
26 Aug 14
-
24 Jun 14
Zhang LukeThis tool is very useful when you want to not click your mouse anymore
maybe your fingers hurts
maybe your mouse is broken
anyway autohotkey can use keyboards instead of your mouse and it can also do a lot of other stuff such as clicking many times
or some rutine job
by the way it can also help you keep notes or using short spell for special sentense -
19 Feb 14
-
15 Feb 14
-
08 Feb 14
-
RunWait Notepad MsgBox The user has finished (Notepad has been closed).
-
To learn more about launching programs -- such as passing parameters, specifying the working directory, and discovering a program's exit code
-
-
15 Dec 13
-
06 Dec 13
-
17 Oct 13
-
13 Aug 13
-
07 May 13
-
See the Send command for a complete list of special characters and keys.
-
Finally, keystrokes can also be sent in response to abbreviations you type, which are known as hotstrings. For example, whenever you type Btw followed by a space or comma, the following line will replace it with "By the way":
-
-
11 Apr 13
-
15 Mar 13
-
12 Jan 13
-
02 Dec 12
-
08 Jul 12
-
13 Jun 12
-
04 Mar 12
-
14 Aug 11
-
06 Aug 11
-
12 Jul 11
-
01 Jul 11
-
18 Apr 11
-
11 Apr 11
-
on your desktop or in a folder of your choice
-
the first character "#" stands for the Windows key; so #space means holding down the Windows key then pressing the spacebar to activate the hotkey
-
that the subsequent command should be executed whenever this hotkey is pressed
-
-
-
28 Feb 11
-
09 Feb 11
Engelbert Tejedagls*autohotkey carriage return
kwd:{windows,lang,scripting,programming,io,input,output,carriage,return,linefeed,special,characters -
17 Jan 11
-
26 Nov 10
-
17 Nov 10
-
03 Aug 10
Bhaskar GhoshA very powerful scripting tool to automate windows tasks, capturing keystrokes and mouse actions.
software tools autohotkey tutorial hotkeys windows macros macro
-
06 Jun 10
-
20 May 10
-
04 May 10
-
06 Apr 10
-
31 Mar 10
-
- Download and install AutoHotkey.
- Right-click an empty spot on your desktop or in a folder of your choice.
- In the menu that appears, select New -> AutoHotkey Script. (Alternatively, select New -> Text Document.)
- Type a name for the file, ensuring that it ends in .ahk. For example: Test.ahk
- Right-click the file and choose Edit Script.
- On a new blank line, type the following:
#space::Run www.google.com
o create a new script:
-
- Save and close the file.
- Double-click the file to launch it. A new icon appears in the taskbar notification area.
- Hold down the Windows key and press the spacebar. A web page opens in the default browser.
- To exit or edit the script, right-click the green "H" icon in the taskbar notification area.
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. The :: means that the subsequent command should be executed whenever this hotkey is pressed, in this case to go to the Google web site. To try out this script, continue as follows:
-
- Multiple scripts can be running simultaneously, each with its own icon in the taskbar notification area.
- Each script can have multiple hotkeys and hotstrings.
- To have a script launch automatically when you start your computer, create a shortcut in the Start Menu's Startup folder.
Notes:
-
Launching a program or document
-
The Run command is used to launch a program, document, URL, or shortcut. Here are some common examples:
Run Notepad Run C:\My Documents\Address List.doc Run C:\My Documents\My Shortcut.lnk Run www.yahoo.com Run mailto:someone@somedomain.com
-
A hotkey can be assigned to any of the above examples by including a hotkey label. In the first example below, the assigned hotkey is Win+N, while in the second it is Control+Alt+C:
#n::Run Notepad ^!c::Run calc.exe
-
The above examples are known as single-line hotkeys because each consists of only one command. To have more than one command executed by a hotkey, put the first line beneath the hotkey definition and make the last line a return. For example:
#n:: Run http://www.google.com Run Notepad.exe return
-
If the program or document to be run is not integrated with the system, specify its full path to get it to launch:
Run %A_ProgramFiles%\Winamp\Winamp.exe
-
In the above example, %A_ProgramFiles% is a built-in variable. By using it rather than something like C:\Program Files, the script is made more portable, meaning that it would be more likely to run on other computers. Note: The names of commands and variables are not case sensitive. For example, "Run" is the same as "run", and "A_ProgramFiles" is the same as "a_programfiles".
To have the script wait for the program or document to close before continuing, use RunWait instead of Run. In the following example, the MsgBox command will not execute until after the user closes Notepad:
RunWait Notepad MsgBox The user has finished (Notepad has been closed).
-
-
29 Mar 10
-
27 Feb 10
-
%A_ProgramFiles%
-
,{Enter}
-
{ WinActivate }
-
-
18 Feb 10
-
07 Feb 10
-
See the Send command for a complete list of special characters and keys.
-
To add text to the end of a file (or create a new file), use FileAppend as shown in the following example. Note that it uses `n (linefeed) to start a new line of text afterward:
-
-
30 Sep 09
d nAnnotated link http://www.diigo.com/bookmark/http%3A%2F%2Fwww.autohotkey.com%2Fdocs%2FTutorial.htm
-
"#" stands for the Windows key
-
:: means that the subsequent command should be executed whenever this hotkey is pressed,
-
program, document, URL, or shortcut
-
Run mailto:someone@somedomain.com
-
and make the last line a return
-
more than one command executed
-
put the first line beneath the hotkey
-
not integrated with the system, specify its full path
-
%A_ProgramFiles% is a built-in variable.
-
commands and variables are not case sensitive
-
to close before continuing, use RunWait instead of Run
-
not execute until after the user closes Notepad:
-
(foremost) window by using the Send command
-
(ensure that a window such as an editor or draft e-mail message is active before pressing Win+S
-
return
-
keystrokes can also be sent in response to abbreviations you type, which are known as hotstrings
-
AutoScriptWriter or Window Spy
-
Click 112, 223
-
without clicking, use MouseMove.
-
drag the mouse, use MouseClickDrag.
-
To activate a window (make it foremost), use WinActivate.
-
detect whether a window exists, use IfWinExist or WinWait.
-
waits for the Untitled window to appear, a
-
(case sensitive)
-
-
02 Aug 09
-
14 Jul 09
-
29 May 09
-
13 Apr 09
-
20 Mar 09
-
19 Mar 09
-
17 Mar 09
-
18 Dec 08
-
08 Dec 08
-
02 Dec 08
-
02 Nov 08
-
25 Oct 08
-
However, in the absence of hotkeys and hotstrings, a script will perform its commands sequentially from top to bottom the moment it is launched.
-
-
21 Oct 08
-
03 Sep 08
-
20 Aug 08
-
11 Jul 08
-
09 May 08
-
11 Apr 08
-
27 Mar 08
-
24 Mar 08
-
22 Mar 08
-
13 Mar 08
-
20 Jan 08
-
09 Jan 08
-
17 Dec 07
-
07 Nov 07
Yak Wallamacro macros script scripts scripting key keys keystroke keystrokes keyboard mouse auto automate automated automatic software utility utilities app application applications program programs free programming programmable custom customize customized
macro macros script scripts scripting key keys keystroke keystrokes keyboard mouse auto automate automated automatic software utility utilities app application applications program programs free programming programmable custom customize customized softwar
-
04 Nov 07
-
19 Sep 07
-
12 Sep 07
-
09 Sep 07
-
16 Jul 07
-
24 Jun 07
-
24 May 07
-
15 Apr 07
-
03 Apr 07
-
02 Mar 07
-
15 Jan 07
gialloporporaPiccolo e utile tutorial per utilizzare e scrivere script per Autohotkey.
-
21 Dec 06
-
15 Dec 06
-
24 Nov 06
-
02 Nov 06
-
31 Jul 06
-
24 Apr 06
chichelinuxThis brief introduction will help you start scripting your own macros and hotkeys right away.
-
12 Apr 05
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.