Macro-roni
Wonk wonk. I need to find a better system for picking post names. I've been using a sweet little macro / automation utility a lot lately named AutoHotkey. It's very handy for scripting mouse and keyboard stuff (I used it to write a script to farm credits in an online game). For example, my keyboard is missing the "Windows key", which I use frequently for opening explorer (Win+E) and for minimizing all windows (Win+M). So, I install AutoHotkey, drop it in the startup folder, and edit the default script to remap Alt+E and M to Win+E and M:
!e::Send, #e
!m::Send, #m
^` Up::Send, {delete}{end}\n{enter}
The last is a quick macro I used when editing some code. I had a big string I had pasted in from a shell. I wanted to create a String variable out of it in Eclipse. This "required" either 5 keystrokes per line, writing a regular expression search and replace, or writing a macro. Which way is fastest? Considering the number of lines, I've got to go with either the regular expression or the macro.
Since I've already played with regexes today I went with the macro. Plus, I get a post out of it. Score! The commands it executes should be mostly self-explanatory. The command side says to execute the macro when I release the Ctrl+` key combination. The "Up" part makes AutoHotkey behave itself for repeated commands. Otherwise, you have to release both keys before re-executing.
Pretty snazzy, even though it doesn't even scratch the surface of what it can do (mouse clicks of course, image detection on a screen region, open / close / move windows, and much, much more). It could also come in handy for scripting repeated data entry in test scenarios if I were either more or less lazy. Unfortunately, I'm at that sweet spot of laziness where I don't mind putting up with minor discomfort. Anyway, a very nice free Windows tool.
Leave a Reply