Академический Документы
Профессиональный Документы
Культура Документы
AutoHotkey FAQ
Language Syntax
When are quotation marks used with commands and their parameters? When exactly are variable names enclosed in percent signs? When should percent signs and commas be escaped?
Common Tasks
Why do some lines in my script never execute? Why is the Run command unable to launch my game or program? How can the output of a command line operation be retrieved? How can a script close, pause, or suspend other script(s)? How can a repeating action be stopped without exiting the script? How can performance be improved for games or at other times when the CPU is under heavy load? How can context sensitive help for AutoHotkey commands be used in any editor? How to detect when a web page is finished loading? How can dates and times be compared or manipulated? Why don't Hotstrings, Send, and MouseClick work in certain games? How can Winamp be controlled even when it isn't active? How can MsgBox's button names be changed?
Language Syntax
When are quotation marks used with commands and their parameters?
Double quotes (") have special meaning only within expressions. In all other places, they are treated literally as if they were normal characters. However, when a script launches a program or document, the operating system usually requires quotes around any command-line parameter that contains spaces, such as in this example: Run, Notepad.exe "C:\M y Documents\Address List.txt"
10/03/13
AutoHotkey FAQ
Common Tasks
www.autohotkey.com/docs/FAQ.htm
2/6
10/03/13
AutoHotkey FAQ
How can performance be improved for games or at other times when the CPU is under heavy load?
If a script's Hotkeys, Clicks, or Sends are noticeably slower than normal while the CPU is under heavy load, raising the script's process-priority may help. To do this, include the following line near the top of the script: Process, Priority, , High
How can context sensitive help for AutoHotkey commands be used in any editor?
Rajat created this script.
10/03/13
AutoHotkey FAQ
S t a t u s B a r W a i t ,D o n e ,3 0 i fE r r o r L e v e l M s g B o xT h ew a i tt i m e do u to rt h ew i n d o ww a sc l o s e d . e l s e M s g B o xT h ep a g ei sd o n el o a d i n g .
How do I put my hotkeys and hotstrings into effect automatically every time I start my PC?
There is a folder in the Start M enu called Startup. If you put a shortcut to your script in that folder, the script will launch automatically every time you start your PC. To create a shortcut: 1. Find the script file, select it, and press Control-C. 2. Right-click the Start button (typically at the lower left corner of the screen) and choose "Explore All Users". 3. Navigate to the Startup folder inside the Programs folder. 4. From the menu bar, choose Edit -> Paste Shortcut. The shortcut to the script should now be in the Startup folder.
I'm having trouble getting my mouse buttons working as hotkeys. Any advice?
Note that mouse hotkeys are not currently possible on Windows 95/98/M e. On other operating systems, the left and right mouse buttons should be assignable normally (for example, "#LButton::" is the Win+LeftButton hotkey). Similarly, the middle button and the turning of the mouse wheel should be assignable normally
www.autohotkey.com/docs/FAQ.htm 4/6
10/03/13
AutoHotkey FAQ
except on mice whose drivers directly control those buttons. The fourth button (XButton1) and the fifth button (XButton2) might be assignable if your mouse driver allows their clicks to be seen by the system. If they cannot be seen -- or if your mouse has more than five buttons that you want to use -- you can try configuring the software that came with the mouse (sometimes accessible in the Control Panel or Start M enu) to send a keystroke whenever you press one of these buttons. Such a keystroke can then be defined as a hotkey in a script. For example, if you configure the fourth button to send Control+F1, you can then indirectly configure that button as a hotkey by using ^F1:: in a script. If you have a five-button mouse whose fourth and fifth buttons cannot be seen, you can try changing your mouse driver to the default driver included with the OS. This assumes there is such a driver for your particular mouse and that you can live without the features provided by your mouse's custom software.
How can keys or mouse buttons be remapped so that they become different keys?
This is described on the remapping page.
How can a hotkey or hotstring be made exclusive to certain program(s)? In other words, I want a certain key to act as it normally does except when a specific window is active.
The preferred method is #IfWinActive. For example: # I f W i n A c t i v e ,a h k _ c l a s sN o t e p a d ^ a : : M s g B o xY o up r e s s e dC o n t r o l Aw h i l eN o t e p a di sa c t i v e . Windows 95/98/M e: Although the above method works, pressing Control-A in a window other than Notepad will do nothing at all (not even its native function). To work around this, use: $ ^ a : : S e n d^ a ;T h i sh o t k e ym u s tb el i s t e d first o nW i n d o w s9 x .T h e$p r e f i xa l l o w si tt o" s e n di t s e l f " . # I f W i n A c t i v e ,a h k _ c l a s sN o t e p a d ^ a : : M s g B o xY o up r e s s e dC o n t r o l Aw h i l eN o t e p a di sa c t i v e .
How can a prefix key be made to perform its native function rather than doing nothing?
Consider the following example, which makes Numpad0 into a prefix key: N u m p a d 0&N u m p a d 1 : : M s g B o x ,Y o up r e s s e dN u m p a d 1w h i l eh o l d i n gd o w nN u m p a d 0 . Now, to make Numpad0 send a real Numpad0 keystroke whenever it wasn't used to launch a hotkey such as the above, add the following hotkey: $ N u m p a d 0 : : S e n d ,{ N u m p a d 0 } The $ prefix is needed to prevent a warning dialog about an infinite loop (since the hotkey "sends itself"). In addition, the above action occurs at the time the key is released.
How can the built-in Windows shortcut keys, such as Win+U (Utility Manager) and Win+R (Run), be changed or disabled?
www.autohotkey.com/docs/FAQ.htm 5/6
10/03/13
AutoHotkey FAQ
www.autohotkey.com/docs/FAQ.htm
6/6