autohotkey_recipes
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| autohotkey_recipes [2012/11/05 19:05] – tkbletsc | autohotkey_recipes [2026/03/19 15:23] (current) – tkbletsc | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | [[http:// | + | [[http:// |
| * [[http:// | * [[http:// | ||
| Line 7: | Line 7: | ||
| ====== Recipes ====== | ====== Recipes ====== | ||
| - | Below are some useful recipes. | ||
| - | * [[Using AutoHotKey to map keys on the Amtelco KB163 Unified Keyboard]]. | ||
| - | * [[Using AutoHotkey to make a second mouse into a multimedia control]] | ||
| - | ===== General ===== | + | Below are some useful recipes. See also: |
| + | * [[: | ||
| + | * [[: | ||
| + | |||
| + | ===== General ===== | ||
| < | < | ||
| + | |||
| ; General controls: | ; General controls: | ||
| ; | ; | ||
| Line 22: | Line 24: | ||
| # | # | ||
| - | ; Win+Backtick | + | ; Win+F12 = Sleep |
| - | #`:: | + | #F12:: |
| ; Win+M = toggle mute | ; Win+M = toggle mute | ||
| #m::Send {Volume_Mute} | #m::Send {Volume_Mute} | ||
| + | |||
| + | ; Alt+Backtick -> Shift+Win_Right (move window to next monitor) -- a shortcut I used on Ultramon for years | ||
| + | !`::Send +#{Right} | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== Capslock on a timer ===== | ||
| + | < | ||
| + | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| + | ; --- CapsLock hold-to-enable, | ||
| + | |||
| + | CapsLock:: | ||
| + | capsHoldTime := 500 ; ms required to enable | ||
| + | |||
| + | ; If already ON → turn OFF immediately | ||
| + | if GetKeyState(" | ||
| + | SetCapsLockState, | ||
| + | SoundBeep, 800, 50 ; disable chirp | ||
| + | SoundBeep, 600, 50 | ||
| + | return | ||
| + | } | ||
| + | |||
| + | ; Start hold detection | ||
| + | SoundBeep, 600, 40 ; start-of-hold chirp | ||
| + | start := A_TickCount | ||
| + | |||
| + | while GetKeyState(" | ||
| + | if (A_TickCount - start >= capsHoldTime) { | ||
| + | SetCapsLockState, | ||
| + | SoundBeep, 600, 50 ; enable chirp | ||
| + | SoundBeep, 800, 50 | ||
| + | |||
| + | ; --- critical fix --- | ||
| + | KeyWait, CapsLock | ||
| + | |||
| + | return | ||
| + | } | ||
| + | Sleep, 10 | ||
| + | } | ||
| + | |||
| + | ; Released early → do nothing | ||
| + | return | ||
| + | </ | ||
| + | |||
| + | ===== Hold down any key ===== | ||
| + | |||
| + | < | ||
| + | ; do right win key + whatever to hold that key down (if it's listed below)># | ||
| + | ># | ||
| + | ># | ||
| + | ># | ||
| + | ># | ||
| + | ># | ||
| + | ># | ||
| + | ># | ||
| + | ># | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== Map gamepad buttons to winamp controls ===== | ||
| + | |||
| + | All the function gunk around Joy2 and Joy3 is for keyboard auto-repeat of Win+A and Win+S (which I map to winamp volume control elsewhere). | ||
| + | |||
| + | < | ||
| + | ; winamp control (if winamp is running) | ||
| + | #If WinExist(" | ||
| + | Joy1::Send {Media_Play_Pause} | ||
| + | Joy4::Send {Media_Stop} | ||
| + | Joy6::Send {Media_Next} | ||
| + | Joy8::Send {Media_Prev} | ||
| + | |||
| + | Joy2:: | ||
| + | Send {LWin down}{s down} | ||
| + | SetTimer, WaitForJoy2, | ||
| + | return | ||
| + | |||
| + | WaitForJoy2: | ||
| + | if not GetKeyState(" | ||
| + | { | ||
| + | Send {LWin up}{s up} ; Release the spacebar. | ||
| + | SetTimer, WaitForJoy2, | ||
| + | return | ||
| + | } | ||
| + | ; Since above didn't " | ||
| + | Send {LWin down}{s down} ; Send another Spacebar keystroke. | ||
| + | return | ||
| + | |||
| + | Joy3:: | ||
| + | Send {LWin down}{a down} | ||
| + | SetTimer, WaitForJoy3, | ||
| + | return | ||
| + | |||
| + | WaitForJoy3: | ||
| + | if not GetKeyState(" | ||
| + | { | ||
| + | Send {LWin up}{a up} ; Release the spacebar. | ||
| + | SetTimer, WaitForJoy3, | ||
| + | return | ||
| + | } | ||
| + | ; Since above didn't " | ||
| + | Send {LWin down}{a down} ; Send another Spacebar keystroke. | ||
| + | return | ||
| + | #If ; EndIf | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== Make the top edge of the main monitor " | ||
| + | |||
| + | If you have a second monitor // | ||
| + | |||
| + | < | ||
| + | SetupClipCheck() ; enable the mouse confinement system (defined below) | ||
| + | |||
| + | ; get access to the winapi ClipCursor function, which limits cursor boundaries | ||
| + | ClipCursor( Confine=True, | ||
| + | { | ||
| + | | ||
| + | | ||
| + | } | ||
| + | |||
| + | ; count the number of loop iterations the mouse has been near the top and un-confine the mouse if there' | ||
| + | SetupClipCheck() { | ||
| + | | ||
| + | | ||
| + | } | ||
| + | |||
| + | top_tick_count := 0 | ||
| + | ClipCheck: | ||
| + | | ||
| + | | ||
| + | ; | ||
| + | |||
| + | If (y <10) { | ||
| + | | ||
| + | } Else { | ||
| + | | ||
| + | } | ||
| + | |||
| + | if (top_tick_count> | ||
| + | | ||
| + | } Else { | ||
| + | | ||
| + | } | ||
| + | | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== Extended mouse buttons mapped to media control ===== | ||
| + | |||
| + | < | ||
| + | XButton2:: | ||
| + | XButton1:: | ||
| + | |||
| + | </ | ||
| + | |||
| + | ===== Mouse click spam ===== | ||
| + | |||
| + | Press F7 to toggle auto-clicking over and over as fast as possible. | ||
| + | |||
| + | < | ||
| + | i:=0 | ||
| + | F7:: | ||
| + | |||
| + | Spam: | ||
| + | Click | ||
| + | Send {LButton} | ||
| + | return | ||
| + | |||
| </ | </ | ||
| ===== Winkey shortcut overrides ===== | ===== Winkey shortcut overrides ===== | ||
| - | Windows by default binds Win+X, Win+B, and Win+Space to stuff I don't care about. | + | |
| + | Windows by default binds Win+X, Win+B, and Win+Space to stuff I don't care about. The script below will remap these to media keys or other key combos that apps can hook without issue. | ||
| < | < | ||
| ; WinAmp+Launchy remaps | ; WinAmp+Launchy remaps | ||
| - | #x::#^x | + | #z::Media_Prev |
| - | #b::#^b | + | #x:: |
| - | #space::^#Space | + | #c::Media_Play_Pause |
| + | # | ||
| + | #b:: | ||
| + | #space::Send ^+{Space} | ||
| + | ; ^ Win+Space -> Ctrl+Shift+Space | ||
| + | |||
| + | ; old simple winamp remaps -- the newer ones above let it work for non-winamps, | ||
| + | ;#x::#^x | ||
| + | ;#b::#^b | ||
| </ | </ | ||
| + | |||
| ===== Auto mouse ===== | ===== Auto mouse ===== | ||
| + | |||
| < | < | ||
| - | ; Auto mouse click: | + | ; Auto mouse click: |
| ; Win+Shift+I | ; Win+Shift+I | ||
| ; Win+Shift+Ctrl+I to auto click quickly | ; Win+Shift+Ctrl+I to auto click quickly | ||
| Line 67: | Line 250: | ||
| ===== FoxIt ===== | ===== FoxIt ===== | ||
| + | |||
| The F5 for reload only works if the active file is the most recently opened. | The F5 for reload only works if the active file is the most recently opened. | ||
| Line 74: | Line 258: | ||
| F5::Send ^w!fr1 | F5::Send ^w!fr1 | ||
| # | # | ||
| + | |||
| </ | </ | ||
| ===== Terraria ===== | ===== Terraria ===== | ||
| + | |||
| < | < | ||
| ; Terraria: middle click is turbo left click | ; Terraria: middle click is turbo left click | ||
| # | # | ||
| MButton:: | MButton:: | ||
| - | SetTimer DoClick, | + | |
| - | SoundBeep 880,50 | + | SoundBeep 880,50 |
| - | return | + | return |
| MButton up:: | MButton up:: | ||
| - | SetTimer DoClick, | + | |
| - | SoundBeep 440,50 | + | SoundBeep 440,50 |
| - | return | + | return |
| # | # | ||
| + | |||
| </ | </ | ||
| ===== Suppress F1 in Explorer, Word, and Excel ===== | ===== Suppress F1 in Explorer, Word, and Excel ===== | ||
| - | The code below will replace the annoying help popup with a low-pitched beep. Change " | + | |
| + | The code below will replace the annoying help popup with a low-pitched beep. Change " | ||
| < | < | ||
| ; Suppress F1 in Explorer/ | ; Suppress F1 in Explorer/ | ||
| Line 102: | Line 291: | ||
| F1:: | F1:: | ||
| # | # | ||
| + | |||
| </ | </ | ||
| + | |||
| ===== Minecraft movement ===== | ===== Minecraft movement ===== | ||
| Line 128: | Line 319: | ||
| | | ||
| - | MButton:: | + | MButton:: |
| | | ||
| Send {w down}{w up}{w down} | Send {w down}{w up}{w down} | ||
| Line 135: | Line 326: | ||
| | | ||
| - | ^MButton:: | + | ^MButton:: |
| | | ||
| Send {w down}{w up}{w down} | Send {w down}{w up}{w down} | ||
| Line 141: | Line 332: | ||
| | | ||
| # | # | ||
| - | </ | ||
| + | </ | ||
autohotkey_recipes.1352171111.txt.gz · Last modified: by tkbletsc
