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

Create static Mail signatures using quotes from 'fortune' Apps
I've written a small AppleScript to generate a fixed citation in your mail signature. It won't be able to generate citations dynamically, as you have to restart Mail to get the new citation, but you can run the script until you get a new citation you are pleased with and from then on Mail will use that signature until you run the script again.

Some additional software installs may be necessary. If you haven't installed fortune from MacPorts or Fink, you must first to so. Then you can obtain the path of the fortune program with which fortune in a Terminal window. There are also options for the command line, like -s for short messages, which can be found by consulting the man page for fortune.

[robg adds: In working on the editing for this hint, we found that you can modify the script presented in this dynamic signature hint to easily create static random signatures. The advantage of this method is that you can use it while Mail is running, and you can also easily make the signatures dyanmic, if you wish. Read on for our modified solution, as well as the author's original version.]

In the AppleScript from the linked hint, you just need to change this line:
set myQuote to some text item of (read "/Users/xxxxxx/Documents/Quotes.txt")
to one of the following (first line for MacPorts; second line for Fink)
set myQuote to do shell script "/opt/local/bin/fortune -s"
set myQuote to do shell script "/sw/bin/fortune -s"
Follow the rest of the instructions in the original hint for setting up the template and actual signatures, and you've got a script that will create static signatures using a randomly-chosen quote from fortune. (If you want to have dynamic random signatures from fortune, follow the cron bits of the linked hint.)

Below is the author's original solution to the problem; we haven't tested this version.
First of all go to the Preferences, and create a new signature with something in it (a test citation below your normal salutation), so you can differentiate that file from your others without a citation. After you have created your signature file, be sure to save it, so it will appear in the Signatures preference tab.

Then go to the ~/Library/Mail/Signatures folder and locate the web archive file which correlates to your new test signature. Copy the name of that file. Then paste this filename into the body of the AppleScript below. An alternative way to do this is to drag the web archive file into the open script between the hyphens in the line containing open POSIX file.

At this point, it is time to try the script by replacing the test citation created above, using the AppleScript below. First determine the last paragraph you want to keep from your salutation, and modify the delete line as necessary.
set myText to do shell script "/opt/local/bin/fortune -s"
tell application "TextEdit"
  open POSIX file "/Users/your_user/Library/Mail/Signatures/random_string.webarchive" as alias
  tell text of document 1
    delete (paragraphs 9 thru -1) -- these are the settings I came up with not necessarily yours
    make new paragraph at after last paragraph with data myText
  end tell
  save document 1 with replacing
end tell
Save the script when you are satisfied, and run it until you have a citation you like. Fire up and try your new signature.
  • Currently 2.00 / 5
  You rated: 3 / 5 (10 votes cast)

Create static Mail signatures using quotes from 'fortune' | 0 comments | Create New Account
Click here to return to the 'Create static Mail signatures using quotes from 'fortune'' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.