views:

3535

answers:

7

Hi, I use AutoHotKey for Windows macros. Most commonly I use it to define hotkeys that start/focus particular apps, and one to send an instant email message into my ToDo list. I also have an emergency one that kills all of my big memory-hogging apps (Outlook, Firefox, etc).

So, does anyone have any good AHK macros to share?

+1  A: 

There are tons of good ones in the AutoHotKey Forum:

http://www.autohotkey.com/forum/forum-2.html&sid=8149586e9d533532ea76e71e8c9e5b7b

How good? really depends on what you want/need.

scunliffe
+4  A: 

Very simple and useful snippet:

; Stuff to do when Windows Explorer is open
;
#IfWinActive ahk_class ExploreWClass|CabinetWClass
    ; create new folder
    ;
    ^!n::Send !fwf

    ; create new text file
    ;
    ^!t::Send !fwt

    ; open 'cmd' in the current directory
    ;
    ^!c::
        OpenCmdInCurrent()
    return
#IfWinActive

; Opens the command shell 'cmd' in the directory browsed in Explorer.
; Note: expecting to be run when the active window is Explorer.
;
OpenCmdInCurrent()
{
    WinGetText, full_path, A  ; This is required to get the full path of the file from the address bar

    ; Split on newline (`n)
    StringSplit, word_array, full_path, `n
    full_path = %word_array1%   ; Take the first element from the array

    ; Just in case - remove all carriage returns (`r)
    StringReplace, full_path, full_path, `r, , all  

    IfInString full_path, \
    {
        Run, cmd /K cd /D "%full_path%"
    }
    else
    {
        Run, cmd /K cd /D "C:\ "
    }
}
Eli Bendersky
I had to add two lines to get this script working in Win7 with AHK 1.048.05: [1] SetTitleMatchMode RegEx ; at top of script in autorun section [2] full_path := RegExReplace(full_path, "^Address: ", "") ; strip to bare address
Leftium
+1  A: 

I use this one all the time, usually for quick access to the MySQL command line.

http://lifehacker.com/software/featured-windows-download/make-a-quake+style-command-prompt-with-autohotkey-297607.php

Feet
+1  A: 

; I have this in my start menu so that I won't ruin my ears when I put on my headphones after rebooting my computer

sleep, 5000
SoundSet, 1.5 ; really low volume
Bård
A: 

The above script is only working when you change "#IfWinActive ahk_class ExploreWClass|CabinetWClass" "#IfWinActive ahk_class CabinetWClass"

Happy Scripting.

Abhishek
A: 

I create new Outlook objects with AutoHotKey

; Win+Shift+M = new email

#+m::  Run "mailto:"

; Outlook

#^M::  Run "%ProgramFiles%\Microsoft Office\Office12\OUTLOOK.EXE" /recycle

; Win+Shift+A = create new calendar appointment

#+A::  Run "%ProgramFiles%\Microsoft Office\Office12\OUTLOOK.EXE"/c ipm.appointment

; Win+Shift+T = create new Task ; Win+Shift+K = New task

#+T::  Run "%ProgramFiles%\Microsoft Office\Office12\OUTLOOK.EXE"/c ipm.task
#+K::  Run "%ProgramFiles%\Microsoft Office\Office12\OUTLOOK.EXE"/c ipm.task
Peter Gfader
A: 

Add surrounding quotes on selected text/word
Useful when writing emails or during coding...

Doubleclick word, hit Win+X, have quotes around

; Win + X
#x:: ; Attention:  Strips formatting from the clipboard too!
Send ^c
clipboard = "%clipboard%"
; Remove space introduced by WORD
StringReplace, clipboard, clipboard,%A_SPACE%",", All
Send ^v
return
Peter Gfader