Random Signatures with Mail
Random Signatures with Mail
- Subject: Random Signatures with Mail
- From: Bill Guion <email@hidden>
- Date: Thu, 08 Dec 2011 10:39:05 -0500
The following script has been cobbled together from a variety of places, including a similar script from Eudora. And it works. Sort of. If I run the script (and then quit it), go to Mail, open a message, it has a new random signature. But, I have to manually run the script each time I want the signature to change. What would be nice is if the script were to run every time I create a new message, or every time I send a message, something so I wouldn't have to remember to run it manually.
Can anyone give me some help with this?
property cut_ : "\\\\"
global _sigcount, _random, _signatures
set _return to (ASCII character 13)
set file_name to "Macintosh HD:Applications:Comm:fortunes" as alias
set quotes to read file_name
split(ASCII character 10) -- line feed
set ls to text items of quotes
split(return)
set quotes to ls as string -- NOT as Unicode text
if quotes does not start with return then ¬
set quotes to return & quotes
if quotes does not end with return then ¬
set quotes to quotes & return
set _paragraphs to paragraphs of quotes as string
set ls to {}
split(cut_)
set _signatures to text items of quotes
set _sigcount to count _signatures
set text item delimiters to {""}
--display dialog quotes
set n to random number from 1 to _sigcount
--display dialog "random number n is " & n
set _sigtext to item n of _signatures
set _sigtext to _return & " -----===== Bill =====-----" & _return & "-- " & _return & _sigtext
--display dialog "random signature is " & _sigtext
tell application "Mail (original)"
set themessage to make new outgoing message
end tell
tell application "Mail (original)" to set content of signature "Random" to _sigtext
--on quit
-- continue quit
--end quit
on split(s)
set my text item delimiters to {s}
end split
-----===== Bill =====-----
--
It's okay to call someone stupid; just don't prove it.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden