Attach random sigs to Mail.app messages

May 23, '02 10:48:11PM

Contributed by: tochoa

This script is useful for replacing Mail.app's very, very lame signatures function. I keep it compiled as an application in the Finder's Script Menu.

I used fortune with a handey flag, which is just a collection of Jack Handey funnies I collected from the Quote Cache and converted to fortune file format (Unix text file and .dat file). This is really the handiest way to make a file of your own signatures. Otherwise, if calling fortune with no flags, you could end up with some strange sigs. For instructions on making your own fortune files, see man fortune and man strfile (Handey fans can email me for a copy of the Handey fortunes file).

Read the rest of the article for the script...

Feel free to distribute with attributions intact. This script is email-where, as in email me and tell me where you're at. I collect country .suffixes. Have fun!

I used "Crazy Message Text" script as the basis for the Mail.app portion of the script, eliminated an error in that script which overwrote an existing message in Mail with contents of the result (used count function to set the result to the new message instead of the first).

Here's the script:

set textResult to do shell script "/sw/bin/fortune handey"
(* Change the fortune flag to your own fortune file or a favorite,
like humorists or zippy.
*)
set theSig to "
---------
Tony O tonyo at mac daht com
" & textResult
(* Put your own address in here.
*)
tell application "Mail"
activate
set newMessage to make new compose message at end of every compose message
tell newMessage
set the content to theSig
end tell
make new message editor at beginning of message editors
set countMessage to count of message editor
set content of newMessage to the content of newMessage
set compose message of message editor countMessage to newMessage
end tell
[Editor's note: I haven't tried this myself yet, but I plan to!]

Comments (12)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020523224811751