How to Add a Little Inspiration to Your Email Signature

I’ve been wanting to jazz up my email signature for some time because, ya know, email signatures are boring and very predictable. At present, my default signature contains just one word: my first name. I thought it might be fun to add an inspirational quote at random to the bottom of my signature line.

Here’s how I did it.

I recently created a spreadsheet of quotes for another project, and I thought it would be cool if I could create a script to consult the spreadsheet and output a formatted quote at random. Turns out, it wasn’t very hard to do just that with a little bit of AppleScript and TextExpander magic. Here’s the AppleScript:

property _quotes : missing value

(*
  Get the list of quotes from a selected Apple Numbers file and cache
  the list of quotes in a property that will be used for subsiquent
  executions of this script.
  
  The list of quotes should be in a table on the first sheet of a 
  Numbers document with the quote in column "A" and the quote's author
  in column "B". The first sheet should only contain one table.
*)
if _quotes is equal to missing value then
  -- Get a reference to the current app that will be activated
  -- after the Numbers document is selected and it's content read.
  set _currApp to (path to frontmost application as Unicode text)
  
  tell application "Numbers"
    activate
    
    set _quotesDocPath to POSIX path of (choose file with prompt ¬
      "Quotes Spreadsheet Location:" default location ¬
      	(path to home folder))
    set _doc to open _quotesDocPath
    tell front document to tell active sheet
      tell (first table whose selection range's class is range) to ¬
        set _quotes to rows's cells's value
    end tell
    
    close _doc
  end tell
  
  tell application _currApp to activate
end if

-- Pick a quote from the list at random
set _quote to item (random number from 2 to count of _quotes) of _quotes

-- Format the quote and output the author's name in all uppercase.
return "\"" & item 1 of _quote & "\" —" & (do shell script "echo " & (item 2 of _quote) & " | tr [:lower:] [:upper:]")

All I needed to do next was create a TextExpander snippet to execute this script when the abbreviation is invoked that outputs my signature. The first time it runs, you’ll be prompted to locate the Numbers spreadsheet containing the quotes you’d like to use. You may also need to give TextExpander permission to read files located in your home folder.

I’m pleased to report it works quite well. The only catch is the TextExpander snippet needs to be slightly changed (for example, adding a new line to the end of the entry) whenever the quotes spreadsheet is updated. This will cause it to reload and cache the quotes.

My Apple Numbers quotes spreadsheet can be downloaded from here. Enjoy doling out little morsels of inspiration one email at a time!

8 Likes