Calling Scripts from Signatures

Many users will find this new feature of SignatureProfiler very exciting. It allows you to interject any data that you can get in text form from any command line into a signature. You could easily incorporate iChat status, uptime count, random quote from a database, etc into you signatures. In addition any standard SignatureProfiler placeholders will be replaced after the script contents are inserted into the signature, so in truth a single signature calling a script can be as dynamic as you are inside that script.

Adding a script to a signature is quite simple. Go into the Signature preference pane and select the signature that you want to change. Form there, you can either right-click (or control-click) choose SigPro Replacements and then at the bottom, you’ll see Add Script…. Selecting this will bring up an open dialog box, from which you can choose any type of file. Find your script and select it. It will be added to the signature in the form:

  • {script:’/Path/to/my/script.scpt’}

As usual, you can enter this entire text yourself without using the menu, but it makes it a little easier. You should use some sort of delimiters around the path though, where the open and close are the same. Any of these characters can be used (as long as the same character is not in the path) [\"'|!@#$%^&*-=_+,.?/\ ]. In addition, any formatting applied to the placeholder will be applied to the resulting string as well.

You can use any scripting language that you like. If the file is a .scpt or .applescript file, then it will be interpreted and run as an applescript. In all other cases the script will be run as an executable shell file, so you must ensure that it can be run this way or you will get errors in your results. So you can easily use perl, shell, or even ruby if you wish.

As mentioned above, any of the normal placeholders that you can use in signatures can be put inside the script and they should be replaced as normal. The only exception to this is a script placeholder for obvious problems of recursion.

The results of the script are always inserted as html, so you should use </br> as line breaks. A simple carriage return will not do anything. But this also gives you the ability to control the output pretty well.

To all those who contributed this idea, thanks very much. Let me know what you think and if there are parts that are not implemented how you would like.

Tags: , ,

 
 

2 Responses to “Calling Scripts from Signatures”

  1. Gravatar of Tom Tom
    10 April 2007 at 21:15

    Hello,
    this is a HUGE and great improvement. Actually something i have waited for, since i dumped KMail.
    However adding lines like:
    {script:”/sw/bin/fortune”}
    or
    {script:”/Users/username/sig.sh”}
    does not work as expected. sig.sh by the way looks like this:
    #!/bin/bash
    echo “test”
    These two lines even crash Mail when changing the Signature.
    Can you help me?
    Best regards,
    Tom

  2. Gravatar of Nathan Barhorst Nathan Barhorst
    20 October 2007 at 01:15

    I found out that there is no PATH in the environment for the script, so, if you want fortune to run, your script needs to be something like:
    #!/bin/sh
    echo “

    "
    /opt/local/bin/fortune
    echo "

Leave a Reply