Monday, February 21, 2011

Insert a date into any program using Autohotkey on Windows

Update. Friday 8 March 2013, 01:00:40 AM. If you like a date picker that outputs any date/time in any format, check out Generic Date Picker Version 2 by Paul Moss - and my adaptation of it in response to a request below by Sanjay Mehta.

I previously wrote a post on how insert a date into various programs using built in short cuts. Well, since then I have discovered the joys of AutoHotkey scripts for windows, which let you do just about everything. So, here is an AutoHotkey script for inserting a date - what I like most about it is that you can adjust the format of your date so easily. This one uses control+F12.

; - Insert Date Time stamp
   FormatTime, xx,, dddd d MMMM yyyy ; This is one type of the date format
   FormatTime, zz,, hh:mm:ss tt ; This is one type of the time format
   SendInput, %xx%, %zz%

The script above will insert a date like this: Monday 21 February 2011, 12:03:26 PM. See the AutoHotkey Help page on FormatTime to see how to make your own format.

Thanks to Mama on the AutoHotkey forum: Input system date and/or time, when u press a hot key.

To use this, you must install AutoHotkey and set up a script in which you can include this snippet.