AutoHotKey – My go-to automation tool

I spent a lot of time programming, and sometimes that means retyping the same thing.  For instance, when I’m in the database, I type ‘select * from ‘ dozens of times a day.  Instead, I can type s*f and autohotkey erases that and puts in ‘select * from’.

SendInput select * from

This works in any window, not just my sql editor.  I have about a dozen auto replace commands that I use all the time, and some of them type in 20+ lines of sql for me.  This 6 character command


Generates this sql

–Report how long queries take
select operation_name,(percentile_cont(0.90) within group (order by duration))/1000 Percetile_90,
(percentile_cont(0.99) within group (order by duration))/1000 Percetile_99,
(max(duration))/1000 max_duration,
(min(duration))/1000 min_duration,
from audit_service aud
where source_application = ‘SLDB’
and aud.CORRELATION_ID in (
select aud.CORRELATION_ID from audit_service aud
and aud.OPERATION_NAME in (‘validateServiceAvailability’)
and aud.AUDIT_TIMESTAMP > sysdate – 10/1440 )
group by operation_name
order by max_duration desc

That’s a pretty good return on investment!

You can also set hot keys to perform actions, just like on fancy multimedia keyboards.  If you’re not using F8 through F12, use those for pause, play, fast-forward, and rewind.  Or Open Chrome, Open IE, Open Firefox, Open Gvim, if you’d rather.

There is even a language for setting up GUIs and programming your own applications, which I haven’t gotten into.  In my next post, I’ll show you how to navigate your web application so you don’t have to keep clicking the same things over and over.

So, if you’re interested in being more productive, making fewer mistakes, and generally being a happier developer, check out AutoHotKey.