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

Attach random sigs to Mail.app messages Apps
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!]
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[6,573 views]  

Attach random sigs to Mail.app messages | 12 comments | Create New Account
Click here to return to the 'Attach random sigs to Mail.app messages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Fortune?
Authored by: bluehz on May 24, '02 08:16:52AM

Maybe I am missing something here - I have no "/sw/bin/fortune handey" nor anything even close. No "fortune" either. Are their some prerequisites to using this hint that are not clearly defined in the tip?



[ Reply to This | # ]
Fortune? - Out of luck? Try rndsig!
Authored by: lllama on May 24, '02 09:23:43AM
A nice alternative to this can be found at the Realm of Anarchy (he's harmless really).
Look for rndsig.tar.gz. It was written as a bash script though, so either install bash or change the first line to sh or tcsh. I'm not too au fait with the shell scripting scene, so I'm sure other changes will be needed.
The real point of this is that the script uses a FIFO, which means that a new sig is generated whenever the .signature file (can be changed) is accessed. Plus it runs as a background process, generating sigs when needed.
Once the author and I sort out our little tiff (I'm the one bugging him to go to the reunion) I'll write a wrapper over it, and add a nice sig file editor.
One more thing...the first sig is a header, the last the footer and all sigs are seperated by #sig# (as I recall).
Bit of effort to get this going, but worth it in my book. Send him an email to bug him to rewrite it: rjy at the realm of anarchy dot co dot uk

[ Reply to This | # ]
Fortune? - Out of luck? Try rndsig!
Authored by: tochoa on May 24, '02 10:40:45AM

I'm thinking that this would work great with Pine, but not with Mail.app. Mail.app does not use a .signature file. But, I''ll give it a try with pine. Thanks for the tip!
Tony O



[ Reply to This | # ]
Fortune? - Out of luck? Try rndsig!
Authored by: lllama on May 24, '02 03:54:13PM

Oops. You are correct. I'm used to all my mail programmes using a separate file. If you do end up using it, or even if you don't, let him know. He's a miserable bugger and it'll cheer him up. :-)



[ Reply to This | # ]
Fortune?
Authored by: russh on May 24, '02 09:27:08AM

You are correct that Fortune is not part of Mac OS X. You can use Fink to install it, or you can get a compiled version of Fortune from VersionTracker. Fortune is a repository of quotes that has been around for years. Some quotes are profound, some goofy, some risque. Many people in the *nix world use it for email sigs or to provide an amusing message as a user logs in to the system.

The Handey quotes are something the poster put together himself -- re-read the post, you'll see that he makes that clear.

I'm looking forward to trying out this tip over the weekend.



[ Reply to This | # ]
Fortune?
Authored by: tochoa on May 24, '02 10:32:55AM

Yes, fortune! Sorry , I'm assuming too much here. Should have posted this in the 'nix category. Fortune is available as a dawin component for OSX - if you're not familiar with a unix prompt, you would have no idea what the heck I'm talking about. My apologies.

This little script is a direct result of my fascination with fortune, which is very addicting. So get yourself a fink installation, and get going. I saw this feature on a mail application a while back - on the BeOs. I loved it and when I saw the planned upgrades to Mail.app (for Jaguar) realised that it (mail.app) was still bahind the curve on a lot of features. Hence the script. I'll be adding a reply-to and a reply-all , planning on writing those this morning.

If anyone wants to access the Handey files for their fortune install, go to my homepage -

<http://homepage.mac.com/tonyo/FileSharing3.html>

Move the files to /sw/share/fortunes and chmod read permissions.

Tony O



[ Reply to This | # ]
FINK
Authored by: bluehz on May 24, '02 09:23:06AM

Ok - I have discovered that the missing components are part of the FINK pkg - maybe that should be explained.



[ Reply to This | # ]
FINK
Authored by: tochoa on May 24, '02 10:16:40AM

Yah - sorry. I really should have posted this in the UNIX category.
Tony O



[ Reply to This | # ]
Random Sigs for Eudora
Authored by: bluehz on May 24, '02 12:22:48PM

Thx for the great tip! I whipped this up for use in my chosen e-mail client.

Some assumption (for sake of this tip - they can be changed as desired):
* Your Eudora mail folder is located in your Documents folder
* You have Fink installed, more specifically you have "fortune" installed in /sw/bin/
* The fortune text and data files are located in /sw/share/fortunes/
* You have previously created a text file called eurandom and generated the .dat file from that text file with strfile and saved the dat file - eurandom.dat in /sw/share/fortunes/

To accomplish random sigs using Eudora and a random sig data file /sw/share/fortunes/eurorandom.dat:

1. Open ~/Documents/Eudora Folder/Signature Folder
2. Select one of the Signature files inside the Signature Folder and duplicate it. Rename the copy to Random
3. Create a Cron job in your crontab with this line
* * * * */sw/bin/fortune eurandom > ~/documents/Eudora\ Folder/Signature\ Folder/Random

Within Eudora - choose Random as the signature file for a msg, this will append the current Random sig onto the current message. If you decide you want to make Random the default sig for ALL your outgoing mail - simply change the crontab entry to:

* * * * * /sw/bin/fortune eurandom > ~/documents/Eudora\ Folder/Signature\ Folder/Default

Note - the above crontab setting will change the random sig every one min. CPU usage is minimal and casues no ill-effects, but if you prefer you can alter the crontab entry to every 10 mins, 1 hour, etc - whatever your preference is.



[ Reply to This | # ]
Random Sigs for Eudora
Authored by: tochoa on May 24, '02 06:31:14PM

That's a really nice cron tip, thanks!

Tony O



[ Reply to This | # ]
Attach random sigs to Mail.app messages
Authored by: MickeyD on Feb 21, '04 08:27:22AM

Being new to the Mac, it's taken me some time to get this working. One question: How do I get this work when I click on the "New" button or %N?

Thanks!

Mike



[ Reply to This | # ]
Attach random sigs to Mail.app messages
Authored by: taxi on May 23, '04 08:28:31AM

Short Answer - you don't.

Long Answer - you still don't, until I find a way to make Mail.app accept signatures of PlainTextSignature, or figure out how to get python to do stuff with RichTextSignature.

And make sure that Mail.app updates it's cache of Signatures.plist (if there is one).

matt.



[ Reply to This | # ]