Developer Toolbox: AutoHotKey – Super Snippets

So I’ve been working with a bunch of REALLY old code lately and one thing I run into over and over again is queries with no queryparam.

While I do have a snippet setup in CFEclipse to insert a queryparam:


But I still have to cut-n-paste the variable, etc. Kind of a pain when doing it over and over again. So I started tinkering with AutoHotKey (my favorite lazy tool) and came up with this:

;-- Wrap selected text in QueryParam (will first strip ' or ") ---
!q::
clipboard =
send ^c
clipwait, 1
If ErrorLevel = 0
StringReplace, clipboard, clipboard, ', , All
{
clipboard =
send ^v
}
return

So now I simply highlight my variable – hit my key combo (in this case [ALT]+[Q] and my text is copied to the clipboard – stripped of quote marks, wrapped in the queryparam and sent back to the editor!

Recent Related Posts

8 thoughts on “Developer Toolbox: AutoHotKey – Super Snippets

  1. Jim,

    I’ve created a stack of CFQueryparam snippets in CFEclipse that wrap variables in old code queries. I’m not sure how I can share them, but I basically have the first part ” in the following box. Saves me tons of time. I love TextExpander on my Mac, but I’ve been looking for a something like this on Linux. Thanks.

    • I was just Twittering about this :)

      Snippets are nice – you can zip them up and easily share them. The nice thing about a text expander is you can use it anywhere. If I have code open in Notepad I can still dump in my ‘snippets’. So far I haven’t found anything similar on Linux :(

  2. And of course my code snippet doesn’t show up. I think this should work…
    Start text: <cfqueryparam value="
    End text: " cfsqltype="cf_sql_char" />

    Also, I sync them between machines with Dropbox. Super helpful that they are stored in xml files.

  3. I use C++ for the string processing. AutoHotKey puts the text on the clipboard, runs the helper exe, and pastes the result back into the original.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>