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
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
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.