Tools I Use – Auto Hot Key

I have decided to start a small series of posts where I share some of my tools, tips and tricks as to how I make my work and personal life a bit “better”.

The first of these tools is AutoHotkey.

“Fast scriptable desktop automation with hotkeys. Creating your own apps and macros has never been easier”

For simplicity sake I combine all of the code snippets into a single master script rather than running multiple instances of AHK, I don’t know if this is “better” or has any particular advantages – it’s just the way I have done it.

Window Pad

I use the Window Pad script to implement windows seven style hotkeys to organise and move my windows. This is necessary as my work machine is still running WIndows XP. The ability to throw windows between monitors and position windows to the side or corner of a screen with a single keypress is invaluable.

Volume / Audio

I use the following commands to manage my audio:

#WheelDown::SoundSet, -4 
return
#WheelUp::SoundSet, +4 
return
#MButton::Send {Media_Play_Pause} 
return
With the windows key depressed, rolling the mouse wheel will adjust the volume and clicking the mouse wheel will play/pause any audio.

Text Expansion

This really is where AutoHotkey excels, being able to type a short snippet and have the text replaced with a longer, better formatted version of the text. Rather than list each example I’ll walk you through one in detail and then list the other “types” of expansion I use.

:*:.rg::
formattime, currentdatetime,, yyyyMMdd
sendinput, ^b%currentdatetime% - RG^b : 
return

 A lot of my work involves reviewing and feeding back on documents, typing “.rg” will put (in bold) the current date and then my initials and a colon after which I can continue typing  my comment. I type “.rg Change This” and it becomes “20140502 – RG : Change This”

:*:.d1::
formattime, currentdatetime,, yyyyMMdd
sendinput, %currentdatetime%
return

Replaces “.d1” with todays date in the specified format.

:*:.d2::
formattime, currentdatetime,, dd/MM/yyyy
sendinput, %currentdatetime%
return

 The same as the previous but in a different format.

:*:.asset::
sendinput, 399997
return
This is a simple text replacement, I type “.asset” and it replaces it with the asset number of my work laptop.
I also have the following replacement/expansions:
.cc – My Cost Centre code
.me – My Staff ID
.phone – My phone number
.mobile – My mobile number
.conference – My telephone conference details, include phone number and entry code
Note the leading full stop is not a requirement, it’s just the convention that I have used; I’m quite likely to type “phone” in a generic context but “.phone” should not naturally occur unless I want it to.

Launching Applications

I used to use this a lot more but the only one that has persisted is to quickly launch Notepad by pressing windows key and N:

#n::
run notepad
return

General Usability

I spend a lot of time copying and pasting content between documents and applications and formats. Each application has it’s own way of “paste values” ie remove any formatting. I use the following script bound to Ctrl+Shift+V to paste unformatted:

^+v::
;shift+ctrl+v to paste just text
Clip0 = %ClipBoardAll%
ClipBoard = %ClipBoard%
Send ^v
Sleep 50
ClipBoard = %Clip0%
VarSetCapacity(Clip0, 0)
return

If you find any of these useful or have any suggestions of your own scripts please let me know in the comments.

Leave a Reply