Archive for the Category Tutorial

 
 

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.

Using the New Random Quote Feature

With the release of version 1.4.2, you now have the ability to create a simple text file that can be used as a source of random quotations to be incorporated into your signatures. Once you have created this file you can simply insert a simple {random.quote} placeholder into your signature to have it pick one for you. In addition, you can associate an author and a citation/source to that quote to be inserted separately. Read on for more details and some examples.

The main emphasis of this update of SignatureProfiler is to include access directly from a signature to scripts so that users who have a built up set of quotations in a database or who want to include some information about the status of their machine could do this. However, since I know that not all users are adapt at writing applescripts or perl scripts or some other kind, I thought I would also provide a simple capability to create a simple list of quotations, with authors and citations, that anyone could create and use. To see more about the script access capabilities in this version, see the post Calling Scripts from Signatures.

Ok, so how does a user create and add her quotation list file? Simple. In the iTunes & Quotes (previously just iTunes) tab in the SignatureProfiler preferences pane, the bottom half allows you to designate the file that you would like to use as your quote list file. One the file has been chosen, it will display the quotations in the bottom table, but you cannot yet edit them here. They are just for display to so that you can verify that it actually read the file correctly.

MailScreenSnapz007

So then, now you just have to create a text file. Each quotation should be on a single line, but it can also have an author and a citation or source to go along with it. The author and citation should be separated from the quote by a semi- colon (:). If your quotation, author or citation has a semi- colon within it you must delimit that piece with some kind of character from this list ( \”‘|!@#$%^&*-=_+,.?/\ ) (the last one is a space!). You can always use these characters for delimiters, but you must if your text has a semi- colon.

Create you file as a simple text file in program like TextEdit or BBEdit and save it wherever you like. Then from with the above mentioned iTunes & Quotes tab of the preferences pane, select that file.

So, here are a couple of examples of what some lines from this file might look like. These examples are from the same file as you see in the image above. (Note that each of these is on a single line in the text file)

  • Quick to judge, quick to anger, slow to understand, ignorance and prejudice and fear walk hand in hand:Neil Peart:Witch Hunt
  • “Life is like a box of chocolates, you never know what you’ll get”::Forrest Gump
  • Where’s the beef!?
  • Life, liberty and the pursuit of happiness::Declaration of Independence|Are we ‘green’?|:Ruby Rhod:The 5th Element

So now how can this information be used inside of a signature? Three new placeholders have been added, which you can also access from the placeholder menu in the Signature’s preference pane. They are:

  • {random.quote}
  • {random.quote.author}
  • {random.quote.citation}

The first will be replaced by the actual quotation, the second, by the author, if one was indicated for that quote and the last is the citation or source, also if one was indicated. So if you have a signature that looks like this:

Signature with random quote

You would get these three as possible outcomes from the file listed above:
Random Example 1
Random Example 2
Random Example 3
One thing to note in the last example, the text ” – in ” is placed into the signature as well, despite not having any author or citation. This is because it is in the actual signature above. So you might want to consider this when creating your signature and signature file. If the signature itself was something like this instead:

  • {random.quote} {random.quote.author} {random.quote.citation}

Then I could put the relevant text into the file list, maybe like this:

  • ‘”Quick to judge, quick to anger, slow to understand, ignorance and prejudice and fear walk hand in hand”‘:by Neil Peart:from the song <i>Witch Hunt</i>
  • |”Life is like a box of chocolates, you never know what you’ll get”|::in Forrest Gump
  • Where’s the beef!?
  • Life, liberty and the pursuit of happiness::’- Declaration of Independence’|Are we ‘green’?|:Ruby Rhod:The 5th Element

When you do this though, be sure to use some delimiters to ensure that the full string is interpreted correctly. For example since the dash (-) is normally seen as a delimiter, if you start a citation or author with that, you should use some other delimiter character around the entire part.

I hope that this was helpful.

Using the iTunes Integration with SignatureProfiler

Although the iTunes integration into signatures is a rather frivolous need, it’s one of the original things that I had wanted to do. After all, we Mac users like to share stuff right? There used to be an even cooler shareware tool that would create an image and upload the image to a server even few minutes of what was playing in iTunes. Then you could link to that image in an email or web site or whatever. I liked that very much and thought it was cool, but they could no longer support the server so the service disappeared. That program (whose name I unfortunately can’t remember) was better because it always showed the current status. I had to settle for showing what is playing when the message is sent.
Example iTunes Signature
Anyway, below the fold are some examples of how these signatures can be used and a couple of gotchas to look out for and avoid.

The first thing to get straight when using the iTunes functionality is that there are one set of placeholders that strictly fill in data from iTunes whatever its status. The three placeholders:

  • {itunes.playing.song}
  • {itunes.playing.album}
  • {itunes.playing.artist}

will be replaced with empty strings if iTunes is stopped or not running. This is why the {itunes.display.info} placeholder exists. This allows you to choose four different, but complete signatures to use for each of the states of iTunes (the four states are “Playing”, “Paused”, “Stopped” and “Not Loaded”. This way you can decide that for all states but playing, you’ll have “None” as the signature for the info placeholder. Then when iTunes is in the three other states that placeholder will be replaced with an empty string.

But it also let’s you designate more meaningful signatures for each of the states if you wish. Say, we create four signatures like these:
iTunes Playing Signature
iTunes Paused Signature
iTunes Stopped Signature
iTunes Not Running Signature
In the iTunes tab of SignatureProfiler’s preference pane, we’ll set the different signatures for the four states. Assume that we’ll assign the top-left signature, to the iTunes State of “Playing”, the top-right to “Paused”, the bottom-left to “Stopped” and the bottom-right to “Not Loaded”. To set these, choose the state you want to set from the top menu and then pick the signature that you would have created in the bottom menu.
Choosing iTunes Signature
Then once you compose a message and select a signature that uses the {itunes.display.info} placeholder, you’ll get the correct version of the iTunes signature displaying in your signature. Here are what my four look like.
iTunes Playing Example
iTunes Paused Example
iTunes Stopped Example
iTunes Not Loaded Example
Hope that you enjoy it.

Inserting Link and Image Placeholders

The addition of these two placeholders facilitates the inclusion and editing of images and hyperlinks in a signature. Although the current Signature preferences pane does offer the ability to insert a hyperlink, it’s not as obvious as it should be how to properly format it and editing it is even worse and very error prone. Although the solution that SignatureProfiler provides is not perfect, it seems better to me. I hope to improve it even more in the future.

In order to put a hyperlink or image link into the signature, you simply need to control-click (or right-click) in the signature pane where you want to insert the link. Note that sometime the editor is a little vague about selection when you control-click, so give it a try first to see how it behaves. The menu that you see looks like this:
SignatureProfiler Context Menu
The last two items in that menu are the ones that we’ll look at. When either is selected, you’ll get an sheet that looks like the one below. Note that the only difference will be that one has text for links and the other for images. The fields are essentially the same however.
Link or Image Entry Sheet
The URL for the image or link indicates where to go an get the information. This should be a valid, reachable URL. No checking will be done at the time of entry to ensure that the link is valid. “Description” is the text that will be shown in the case of a hyperlink and is the descriptive text of an image. It is optional for an image.

After you hit the “Insert” button, the text that is entered into the signature looks less than friendly I must admit, but if you stick to editing just the link or description, you should be fine. Here is an example with both a link and an image inserted:
Link & Image Example
Another pointer for editing: if you want to change the formatting of a link, be sure to select the entire placeholder. Do not select part of the placeholder and apply formatting to it, this will break SignatureProfiler’s ability to find the placeholder properly.

Also, be aware that often Mail will not load the image correctly in the message compose window. You will see the standard icon indicating that an image cannot be loaded (
Missing Image Icon). However, the image will be seen by the recipient if they don’t have thier client set to not retrieve images. do a test by sending yourself a mail first. You will also notice that the preview of tail signatures in the SignatureProfiler preference pane doesn’t represent these properly. It is not yet capable of displaying HTML, that will come in a later version.

Using Tail Signatures

You might be wondering how to best utilize the Tail Signature feature of SignatureProfiler. I’ll give an example here that will hopefully make this feature clear. It isn’t really complicated, but examples are always good to see to give a good idea.

Tail signatures can include all of the other placeholders that SignatureProfiler provides, except for the tail signature placeholder itself. If that placeholder exists within a signature that you use as a tail signature, it will be replaced with an empty string to avoid a loop.

For our example here we’ll start with the tail signature for our example. Let’s assume that the Account that we will use actually has two email addresses attached to it (joe.shmoe@littleknownsoftware.com and john.doe@littleknownsoftware.com) and that we have set one to use the tail signature of the Account, but the Joe Schmoe uses a different tail signature. The configuration for this looks like this:
Account Setup
We can see that the tail for John Doe has been set to use that of the account. We can’t see the other in the image, but it is set to use “Display Tail 2″. With the original “Display Tail” signature looks like this:
Example Tail Signature
You can see that in the Account configuration screen the tail example is udated to show what it will look like. Note that the user name is replaced as John Doe, however the user name of the account (entered in the Accounts preference pane) is set to “Display Account”. The “Name for Selected Address:” field allows us to override the Account settings for each email address if desired.

Okay, so now let’s look at a couple of example signatures for this account and see what the results will be. Here is the first signature as it appears in the Signatures preference pane.
Example Signature 1
And here you see the resulting mail with the values replaced. Note that the menu for choosing the address to send from shows the Account name (Display Account) and the email address (john.doe@littleknownsoftware.com). However, you’ll see that the replacements are relevant to the email address, with the user name being “John Doe” instead of “Display Account”, as was configured in the SignatureProfiler preference pane above.
Replaced Signature
As another example, if we start with this tail:
Second Tail Signature
We will get, for the same original signature chosen in the mail composer screen, a message that looks like this, having chosen the joe.schmoe email address:
Mail Example Two
That’s about it really. Next I’ll do an example using the image and link replacements to show how those are used and why they are somewhat easier to use than the “Add Hyperlink…” menu item in the Signature preferences pane.