Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Add a glossary of text strings to Mail.app Apps
I have a number of pre-defined text strings I like to insert into e-mail messages--address, bank account, etc. I've written a 'quick & dirty' AppleScript to do this for me. You may find it useful too, or as the basis for a fully-fledged script.

In my ~/Library -> Scripts -> Mail Scripts folder, I've created a Glossary folder, and in there, I have a number of these scripts (identical except for the GlossaryEntry property). To insert into an e-mail, just position the cursor at the appropriate point in the body of the message, and run the script from Mail's scripts menu.

Here's my Address entry script:
-- 2004-06-24 Tom Robinson

property GlossaryEntry : "Tom Robinson" & return & 
  "xx Garfield Street" & return & 
  "Brooklyn" & return & 
  "Wellington" & return & 
  "Aotearoa New Zealand" & return

KeyIt(GlossaryEntry)

on KeyIt(WhatToKey)
  tell application "System Events"
    set CharBuffer to ""
    
    repeat with i from 1 to number of characters in WhatToKey
      set ThisCharacter to character i of WhatToKey
      if ThisCharacter is "'" then
        keystroke CharBuffer
        set CharBuffer to ""
        keystroke "}" using option down
      else if ThisCharacter is "—" then
        keystroke CharBuffer
        set CharBuffer to ""
        keystroke "_" using option down
      else if ThisCharacter is "" then
        keystroke CharBuffer
        set CharBuffer to ""
        keystroke ";" using option down
      else if ThisCharacter is "–" then
        keystroke CharBuffer
        set CharBuffer to ""
        keystroke "-" using option down
      else
        set CharBuffer to CharBuffer & ThisCharacter
      end if
    end repeat
    
    if CharBuffer > "" then keystroke CharBuffer
  end tell
end KeyIt
Special characters like ellipses and em-dashes were causing problems for keystroke, that's why they're special-cased above. Note: 'Enable access for assistive devices' needs to be turned on in the Universal Access System Preferences panel in order for this to work.
    •    
  • Currently 2.25 / 5
  You rated: 3 / 5 (4 votes cast)
 
[5,846 views]  

Add a glossary of text strings to Mail.app | 5 comments | Create New Account
Click here to return to the 'Add a glossary of text strings to Mail.app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Add a glossary of text strings to Mail.app
Authored by: ether on Oct 04, '04 01:04:19PM

TypeIt4Me (www.typeit4me.com) lets you define short abbreviations
for things you type all the time. I rely heavily on abbreviations in emacs, and the lack of a similar feature systemwide was a serious bummer.

T4M fills the gap (mostly), especially since version 2 came out, which lets you turn it off in some apps (like terminal). You very quickly become dependent on the abbrevs. For example, typing "although" instead of "altho" would be a major pain. It's also handy for common typos, like "adn" which I have set to autocorrect to "and".

I have just under 500 abbrevs--anything I type repeatedly. The more you have, the faster you can type. You can save a lot of time on contractions, too, if you define the right abbrevs: I have "il", "dont", and "theyre" defined to "I'll", "don't", and "they're", respectively. The first saves me a keystroke for the second "l", a shift for the "I" and a pinky move for the dreaded "'".

The only drawbacks are that you have to be careful that you don't define an abbrev that's also something you might want to type, because you might miss it. I once sent mail to my friend "Jan" addressed to "January" :-). Also, it's a bit slow. You have to get used to adding a slight (about 3 keystroke, in my case) pause for it to expand an abbrev, or it eats the keystrokes typed then.



[ Reply to This | # ]
Use LaunchBar
Authored by: stokini on Oct 04, '04 02:51:31PM

I use LaunchBar for that. Just save any text as a file ending with either ".clip.txt" or ".clip.rtf". Then type command-space to activate LaunchBar, type the abbreviation for a text clipping you've saved, press return, and the contents of the file are inserted at the cursor location.

In Mail, for example, I use it when I want to give someone my address and phone numbers. I named my clipping "contact info.clip.txt", so I type command-space, the letters c-o-n, and return. Very quick and easy, and no need to reach for the mouse.



[ Reply to This | # ]
Use SpellCatcher
Authored by: PaulIngraham on Oct 04, '04 11:45:23PM

There's an even better solution, I think. I was a TypeIt4Me user for many years, and I am a LaunchBar enthusiast now... but Spell Catcher (developer is at www.rainmakerinc.com) is hands down the best tool for this job (and many others). It's a cross-application spell checker -- one spelling reference for all applications -- with numerous additional writing and editing tools. Best of all are the powerful shorthand features.

I am health care professional, and I use hundreds of Spell Catcher shorthands in my clinical charting. For years now, I have been using Spell Catcher to write words like "sternocleidomastoid" by typing "scm". I routinely insert even very large strings, like the shorthand "1stappt" expanding into a message several paragraphs long that I send to every new client. It's fast, reliable, highly configurable, and actively developed and supported.

The shorthand features also integrate well with the spell checking (for instance, you can expand shorthands while typing, or you can wait and do them all at once as part of a spell-check).

Seriously, SpellCatcher is the only application I use that is more integrated into my workflow than LaunchBar, and that's saying a lot. Check it out.

(No, I don't work for the company. Just like the product. :-)



[ Reply to This | # ]
Use SpellCatcher
Authored by: Pierre Igot on Oct 05, '04 09:37:28PM

I concur. Spell Catcher X is by far the best tool for this kind of thing. I am also a devoted LaunchBar user, but there is no way that I could use it for intensive shorthand use the way I use Spell Catcher. You need to a tool that can expand abbreviations automatically as you type, without having to invoke a list of entries or use a special keyboard shortcut.

As for TypeIt4Me, I have never used it in Mac OS X, but what I can say is that Spell Catcher X doesn't suffer from the problems described by Ether in TypeIt4Me. It performs very well and actually helps with the annoying stalling problems in Word X/Word 2004!

Spell Catcher also provides lots of additional functionality, such as support for multiple languages, automatic punctuation, autocompletion with Address Book data, etc.

Simply put, no one using Mac OS X for writing should be without it -- unless you actually enjoy typing out stuff in full over and over again, that is :).



[ Reply to This | # ]
Use LaunchBar - does this work?
Authored by: jfrankov on Oct 27, '04 03:16:59AM

when i do this, the file opens up in textedit. it doesn't insert the files contents into my Mail message. am i doing something wrong?

---
--
Jason Frankovitz



[ Reply to This | # ]