AutoHotkey - Display all Hotstrings

12/13/09

Permalink 10:49:28 am, by truewill Email , 192 words, 407 views   English (US)
Categories: Tips, Windows, Tools

AutoHotkey - Display all Hotstrings

I wrote my first real AutoHotkey script yesterday. I’ve been using the program for a week or so to provide keyboard macros, but I wanted a way to list all of my hotstrings (abbreviation-expanders).

I set up my hotstrings to start with two dots (..) and to not require an ending character (like space or tab). So if I type “..e” it will be replaced with my email address. That’s set up as:

:c*:..e::myemail@my.domain

Here’s my first cut at a macro to list the hotstrings in the current script. I haven’t found a way to get at the metadata for this yet, so I’m loading the current script file as text and parsing it with regular expressions. Note that this does not depend upon my two-dot convention. It does have to be in the same file as the hotstrings, though. I don’t list the expansion text, as that can get pretty long (snippets of SQL, etc.).

; == HOTKEYS ==

#H::
; Windows + H: Display all Hotstrings

FileRead, ScriptContents, %A_ScriptFullPath%

if not ErrorLevel
{
  AllHotstrings := ""

  Loop, parse, ScriptContents, `n, `r
  {
    if (RegExMatch(A_LoopField, "^:.*?:(.+?)::", SubPat))
    {
      AllHotstrings := AllHotstrings . SubPat1 . "`n"
    }
  }

  MsgBox 0, Hotstrings, %AllHotstrings%
}

return

Comments, Pingbacks:

Comment from: Steven Kohlmeyer [Visitor] Email · http://www.StevenKohmeyer.com
Ever use AutoIT?
PermalinkPermalink 02/25/10 @ 18:58
Comment from: truewill [Member] Email · http://www.truewill.net
@Steven Kohlmeyer - No, I haven't tried that one.
PermalinkPermalink 02/25/10 @ 19:04

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))
The name truewill is composed of two other words. What is the SECOND word?

Development Central

Development Central is the blog of Bill Sorensen, a professional software developer. Much of this will relate to C#, .NET, and OOP in general.

Disclaimer
These postings are provided "AS IS" with no warranties and confer no rights.

Search

Categories

Linkblog

b2evolution

contributors

XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 4

powered by b2evolution free blog software