Tech Talk A software developer on all things tech, and then some


AutoHotkey – My Top Scripts

AutoHotkey, my new favorite hotkey/snippet tool. It can do things from opening your frequently used folders or applications with a few button presses, to replacing lines and words with snippets, or even interacting with your mouse. If you haven't started using AutoHotkey yet to increase your efficiency, start. You will notice immediately a decrease in time spent doing menial tasks, giving you more time to focus on the important stuff while also ensuring you finish those important projects on time. This tool allows for total customization for the adventurous and can be done with little to none scripting knowledge. Now, if I've caught your interest with AutoHotkey, feel free to put together some of the following code, and get started with my favorite AutoHotkey scripts!

BTW, if you need a quick start, either follow AutoHotkey's tutorial, or read my first post about Googling anywhere with AHK

Minimize The Current Application

For the many times when you are typing in an application, and you want to minimize, but not leave the keyboard. Even being a developer and support, I don't think I've ever needed the caps button. Why not make it useful now? (Idea from Lifehacker)


Google in Any Application

I recently before this post wrote about how to do this, but I thought I'd include in this article so everything is in one place. The following script will take whatever you have highlighted and search for it on Google using your default browser.

#g:: ;Google something
clipboard = ; Empty the clipboard
Send ^c ;Copy the current text that is highlighted

Window Always On Top

There has been quite a few times that I'm using a document for reference and need to go back forth, forcing me to have to switch between one to type, then the other to look up. (This has happened a lot less since Windows 7 and being able to quickly move the windows, but still occurs from time to time). The following script will actually keep whatever window on top until you you press the shortcut again.

#t:: Winset, Alwaysontop, , A

Use Ctrl V in CMDPrompt

If you are like me and still use the command prompt for a few tasks in Windows, this can save you quite a bit of time instead of having to right click, keeping your hands on the keyboard.

#IfWinActive ahk_class ConsoleWindowClass
SendInput {Raw}%clipboard%

Print in Plain Text

I can think of far fewer times when I needed to paste with formatting, then when I needed to just quickly paste in plain text. With this script, pressing Windows Key + v will paste in plain text, not matter the application. Be mindful however, this will erase images you have in your clipboard if you attempt to paste an image in plain text.

clipboard = %clipboard%
SendInput, ^v

Quick Signature

There are a few times when I need add a quick signature when I'm not in my email client, etc... So creating a quick signature snippet will save me the few seconds to type one out. Notice that the opening '(' and closing ')' will preserve the line breaks

Jacob Saylor

Date Functions

I have needed the current date or date/time countless of times when either logging, making a file name, checking in code, etc... To quickly insert the current date/time, I created three snippets, -date,-dt, and -ts.

-date will display the current date in a month/day/year format.

::-date::	;output = 12/6/2012
FormatTime, CurrentDateTime,, M/d/yyyy
SendInput %CurrentDateTime%

-dt will display the current date-time in a month/day/year hour:min format. Easy on the eyes for some quick logging.

::-dt::		;output = 12/6/2012 1:45 PM
FormatTime, CurrentDateTime,, M/d/yyyy h:mm tt
SendInput %CurrentDateTime%

-ts will display the current date-time stamp that would appear in SQL Server, etc...

::-ts::		;output = 2012-12-06 13:45:04
;2012-12-06 13:23:58.763
FormatTime, CurrentDateTime,, yyyy-MM-dd HH:mm:ss
SendInput %CurrentDateTime%


If you are like me and use Pidgin as your instant messenger tool, this next snippet will be useful to you. By hitting Windows Key + M, you will bring up your chat window. If Pidgin is not running, it will go ahead and start it.

IfWinExist ahk_class gdkWindowToplevel
        Run "C:\Program Files (x86)\Pidgin\pidgin.exe" ;Replace with where Pidgin is installed

Navigating Tabs

In most tabbed applications, ctrl + tab will move to the right tab, while adding a shift before the tab will move to the left. To make this a little easier on the fingers, I changed that to ctrl + Left Arrow, and ctrl + Right Arrow.

Send, {Ctrl Down}{Tab}{Ctrl Up}
Send, {Ctrl Down}{Shift Down}{Tab}{Shift Up}{Ctrl Up}
Comments (1) Trackbacks (0)
  1. Wonderful snippets, thanks a thousand 🙂

Leave a Reply

No trackbacks yet.

%d bloggers like this: