Search This Blog

Thursday, 3 November 2011

How to Stop AutoHotkey from sticking the Shift Key

AutoHotkey is an excellent little program I've mentioned before that lets you define keyboard shortcuts and automatic corrections to your typing. I set it up so that typing Ctrl + Shift + F12 would insert the current date as a text string. Then, when I open my day book (formerly a Word document, now in the Google cloud), I can quickly insert the heading for today. That worked fine. Then I decided to improve it, so that it would start by moving to the end of the document, and also add a newline at the end. Now, not so good. Sure, it moved to the end, and it inserted the correct text. However, afterwards my PC acted as thought the control and shift keys were being held stuck down.

I could clear the problem by actually pressing the keys myself, but this was hardly an elegant solution. After a bit of research I believe that this is an AutoHotkey bug. I present this workaround:

SendMode Input

; - Insert Date Time stamp
+^$F12::
   KeyWait, Shift
   KeyWait, Ctrl
   FormatTime, xx,, dddd d MMMM yyyy
   Send ^{End}%xx%{Enter}
Return

That fixed it for me. Now I just need it to put the date into bold italic.