REQUEST A DEMO

Adding a signature to Log Email in Dovetail Mobile Agent using Ubiquity or GreaseMonkey

As I mentioned in a previous post, I’ve started using Dovetail Mobile Agent for my day-to-day case activities. Its still early in its project lifecycle, so it doesn’t have all of the bells and whistles (yet), but that’s OK with me. For example, you can Log an Email, but it doesn’t have the capability to automatically populate a signature within the email. Since this is something that I wanted now, here’s how to make that happen, without modifying the application itself.

Ubiquity

In a previous post, I detailed my first Ubiquity command for working with Dovetail Mobile Agent.

Now, we’ll add a new command for inserting my signature.

The Ubiquity code:

CmdUtils.CreateCommand({

  name: "signature",
  icon: "http://www.dovetailsoftware.com/favicon.ico",
  author: { name: "Gary Sherman", email: "gary@dovetailsoftware.com"},
  description: "Inserts my signature into the selected area.",
  preview: function( pblock, input) {
    pblock.innerHTML = "Inserts my signature into the selected area.";
  },

execute: function cmd_signature() {
var sig = "nn
Regards,n
Garynn
Gary Shermann
Dovetail Softwaren
gary@dovetailsoftware.comn
512-610-5466n
http://blogs.dovetailsoftware.com/blogs/gsherman/n
n
This message sent via Dovetail Mobile Agent";

CmdUtils.setSelection(sig );
}

})

I simply type Ctrl-space, then signature (or even just enough of the word to be unique, such as "sig"), and the Ubiquity console shows:

ubiquity_signature

And then my signature is filled into the element I’ve selected:

mobile_agent_log_email

 

GreaseMonkey

The Ubiquity script is cool, but I still have to invoke Ubiquity (Ctrl-Space), and then type signature. I’d like to have this done automatically.

In a previous post, I detailed How to use GreaseMonkey to add my own JavaScript to a web application.

I’ll do a similar thing here, using GreaseMonkey to fill in my signature automatically.

The GreaseMonkey script:

function letsJQuery() {
            //Insert signature       
            $("#log-email-form #message").val(signature());

            //Set focus to the beginning of the log email message element
            if (document.getElementById("log-email-form")){
                document.getElementById("message").focus();
                document.getElementById("message").selectionStart=0;
                document.getElementById("message").selectionEnd=0;
            }
    }

function signature() {
var sig = "nn
Regards,n
Garynn
Gary Shermann
Dovetail Softwaren
gary@dovetailsoftware.comn
512-610-5466n
http://blogs.dovetailsoftware.com/blogs/gsherman/n
n
This message sent via Dovetail Mobile Agent";

return(sig );
}

Now, when I use Dovetail Mobile Agent to Log an Email, my signature is automatically filled in, without having to type anything. Much better.

Summary

Remember, what I did above was enhance the application, without modifying the application itself – all using free tools, plus just a little bit of Javascript.

Rockin!