This isn't an introduction to scripting - and focuses on Unix-like systems at present, because that's the problem I needed to solve personally. Suggestions are welcome.
Let's start with a very basic script that will fetch a random signature, then we'll look at how to persuade a few different mail programs to use that to get a signature.
#!/bin/bash lynx -dump -source "http://logicwand.com/tags/random/ash/`basename $0`?"`date +%s` echo
The date +%s will tack a large increasing number on the end of the location, to avoid exuberant caches.
(Presuming you are using something Unix-like, and have bash living in /bin/ If you save this as a file called 'ashok.sig', make sure it is executable (you only need do this once), then run it:
[ash@budvar sigs]$ chmod a+x ashok.sig # Set the script as executable [ash@budvar sigs]$ ./ashok.sig -- ashok a-k ... I'm gonna live forever, or die trying. [ash@budvar sigs]$
Feel free to replace the 'ash' above with your user nickname and the 'ashok' with the name of a sig you have set up under preferences. Once you have that working, you can call it from pretty much any program that will accept an external program to generate sigs.
I use pine (and would rather skip the 'why don't you use mutt?' bit of the conversation). Send me short instructions for other mailers if you can be bothered.
To use an external program in pine go into the options ([M]ain Menu -> [S]etup -> [C]onfig) you set the 'signature-file' option to the name of the script you want to run, followed by the pipe symbol, e.g.
signature-file = bin/sigs/ashok.sig|
Save your settings and then start to compose a new message, it should have a handy-dandy random .sig on the bottom. If - for whatever reason, you would rather not store some of the things in your sig on our server, then just use a more elaborate script to put your sig in above the call to lynx. If you are using multiple profiles the script above is written to get the profile name from the name of the script so I have done:
[ash@budvar sigs]$ cd ~/bin/sigs [ash@budvar sigs]$ ln -s ashok.sig ash.sig [ash@budvar sigs]$ ln -s ashok.sig gallery.sig [ash@budvar sigs]$ ls -l total 4 -rwxrwxr-x 1 ash ash 94 Apr 19 16:07 ash.sig lrwxrwxrwx 1 ash ash 7 Apr 19 16:07 ashok.sig -> ash.sig lrwxrwxrwx 1 ash ash 7 Apr 19 16:07 gallery.sig -> ash.sig
To set up sigs for various rôles I have, then I use those in the Role ([M]ain Menu -> [S]etup -> [R]ules -> [R]oles) configs within pine. It's all pretty simple once you have the script working.
If you want to write instructions for other popular clients or less Unix-y setups (Windows, old-school Macs, &c.) - please mail them to web@logicwand.com.