Re: Newbie wants to script Mail
Re: Newbie wants to script Mail
- Subject: Re: Newbie wants to script Mail
- From: Alexander Sauer-Budge <email@hidden>
- Date: Sun, 9 Feb 2003 13:41:54 -0500
Mail already does this, but it calls them "Signatures". Under
Preferences->Signatures, select "Randomly". You already have a file of
signatures? You will need to import them into Mail, but this isn't
awfully hard (see below). You can also try
<
http://www.fika.org/davew/judebear/MacSignify/index.html> for a
pre-built solution, if you would rather pay $10 than do it yourself.
I successfully added signatures without using the Mail GUI by opening
up the ~/Library/Mail/Signatures.plist file and inserting another DICT
entry in the plist array. For example, I added
<dict>
<key>PlainTextSignature</key>
<string>One man's wit is another man's nit.</string>
<key>SignatureName</key>
<string>Witticism 24897</string>
</dict>
at the end of the file, just before the
</array>
</plist>
tags. The "PlainTextSignature" is a key value I made-up and probably is
meaningless, but Mail excepted it (and converted it into a
"RichTextSignature"). It shouldn't be too hard to roll a simple
drop-script (or a shell script) to append signatures in this manner. I
am sure people on the list will be happy to help you learn how to do
this .
Alex
P.S. This isn't an AppleScript solution, but a Perl one that you run
from the Terminal. It takes as input a file, which should be in the
current directory and whose name should replace signatures.txt, with
one witticism per line and creates a file Signatures.plist (in the
current directory) which you can copy over your
~/Library/Mail/Signatures.plist.
perl -e 'print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE
plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"
\"
http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist
version=\"1.0\">\n<array>\n"; while(<>) { chomp; print
"\t<dict>\n\t\t<key>PlainTextSignature</key>\n\t\t<string>$_</
string>\n\t\t<key>SignatureName</
key>\n\t\t<string>",substr($_,0,32),"</string>\n\t</dict>\n"} print
"</array>\n</plist>\n"' < signatures.txt > Signatures.plist
This is all ONE line entered into to prompt at the Terminal. (save your
fingers, use copy and paste). As always, use at your own risk, no
guarantees, etc.
On Sunday, February 9, 2003, at 12:20 PM, David Lowe wrote:
Greetz!
I am a newly switched Mac user. Mail is great, but i really miss
having "taglines". These are witty 1-liners that are randomly
selected to be tacked on to the end of outgoing messages. Would it be
possible to have a script that opens my tagline file, randomly selects
a line to copy, then pastes the line to the message, and how would i
activate the script from within the mail editor? I have experience in
Basic, Rexx, & some introduction to C++, but don't currently know
anything about AppleScript.
LCD iMac running OS X.2
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.