Making the INSERT Key Useful Instead of Annoying

Y'know how sometimes you go to hit the Home key and you accidentally catch the Insert key too, but you don't realize it until you've typed over something, because suddenly you are in "overstrike" mode rather than "insert" mode? I wanted to kill the Insert key, and immediately thought of my favorite utility, AutoHotKey (upon which I built that Wikipedia AutoCorrect thing). But instead of just killing the Insert key, I thought perhaps I could make it do something useful. So I took the "append" script from here and just changed it to fire whenever I hit Insert, like so:

Insert::
bak = %clipboard%
Send, ^c
clipboard = %bak%`r`n%clipboard%
return

This has two effects:

  1. Hitting Insert no longer puts me in "overstrike" mode.
  2. If I have text selected, it is appended to the clipboard (unlike CTRL+C, which replaces whatever is on the clipboard with your new selection).

UPDATE: I added another script, this one for CTRL-Insert. As a web programmer, I'm sometimes faced with a specific repetitive task of going through text and putting stuff around little chunks of text. In this case, I had a bunch of questions on a page that needed to be emphasized, so I needed to wrap them in STRONG tags. Each question was different, so I couldn't do a find/replace with regular expressions. What I wanted was to select the question, hit CTRL-Insert, and have it automatically put the tags around whatever I had selected. My solution is kinda convoluted, and nobody will care about it but me, but here goes anyway. First, the script:

^Insert::
bak = %clipboard%
Send, ^c
StringReplace, clipboard, bak, @@, %clipboard%
Send, ^v
clipboard = %bak%
return

Then, once you have it installed, the steps:

  1. First, type out your "template". You just need to put @@ wherever you want the selected text to be inserted. For my example, the template looks like this:
    <STRONG> @@ <STRONG>
  2. Next, select your template text and copy it to the clipboard.
  3. You're all set. Select a question (or whatever you want between STRONG tags) and hit CTRL-Insert. Continue selecting and CTRL-Inserting as needed. So in my example, if you select "my dog has fleas" and CTRL-Insert it, it is instantly replaced with
    <STRONG> my dog has fleas <STRONG>

Your IDE might do something like this already, but I like that AHK makes this functionality available in any application. And I can bring it along on my USB key, making me more at home on foreign machines.

10/23/06 @ 11:50 PM

Hi

I'm Jim Biancolo, and this is stuff I found interesting that I thought you might like too. Here are some of my favorites if you want to start there. Mostly I link to other people, but some stuff is mine, like:

Spillover

I am loving Instapaper, and use if to sock away stuff to read. Here are a bunch of articles I read recently and liked.

Archives

Subscribe

Here are the RSS feeds for this site, my Instapaper reading list, and my Instapaper favorites.

"RSS? What in the blazes are you carryin' on about, boy?"

If you prefer, enter your address below to get updates via e-mail. Powered by Feed My Inbox (they have a good privacy policy).