Re-using Applescript in Alfred, Launchbar and Keyboard Maestro

Scripting is definitely not my forte. Having gotten Alfred though a few months ago, I‘ve picked up some scripting capabilities. I stick to Applescript however. Whether I’ve learned how to script, borrowed code from another or actually gotten an entire application from Alfred, scripting is very much a part of what’s needed to make Alfred workflows valuable. In some cases, there have even been people that have helped me in the Alfred forum create scripts to do things through an iterative process. I’ve kind of enjoyed this.

The Portability of Applescript

I’ve developed in Alfred some scripts that I constantly rely on. They’ve been very beneficial. As an example, one of my most useful scripts is to have Mail or Outlook create a new message with a particular email address. I find this not only just a real time-saver but a great convenience.

Since Applescript is portable I thought why not see if some of my scripts work in Launchbar and Keyboard Maestro. I was most interested in Keyboard Maestro as this is a very powerful program and macros can be invoked in many fashions.

Sure enough, it worked in both programs without incident. I can have Keyboard Maestro or Launchbar create a new message from the code I’ve written before in Alfred. One reason I particularly like this with Keyboard Maestro is it is so easy to invoke the code. Alfred isn’t really much more difficult nor launchbar but Keyboard Maestro can be just one key.

There’s another benefit to have this code running in all three environments. Sometimes I’m working in such a way, I tend to be in Launchbar a lot. As an example, Launchbar has a wonderful command I use all the time and that is instant send. I’ll frequently be found sending text from say a notepad I’ve jotted some information down on to DEVONthink or Evernote. Many things I quickly jot down in a Notepad. Later though I realize I want the information for long term storage. In this case, I want that information in DEVONthink or Evernote (generally DEVONthink). I’ll use instant send to send all that information to my target.

Since I’m working in Launcbar, I often think I want to send an email off to so and so from such and such an account. Instead of switching to Alfred, I just invoke it from Launchbar. It’s not really such a big deal if I did this from Alfred or for that matter Keyboard Maestro, I just tend to do it from Launcbar and this premise holds for the alternates.

Applescript Extends power Dramatically

The other thing I’ve found where it comes to all of these products is that Applescript really allows you to extend out the functionality of these programs. This functionality might not be portable between programs due to the way it works in a program yet nonetheless it’s a valuable piece of functionality.

As an example, I have a program in Alfred that allows you to create an email addressed to a number of users at the same time, all chosen dynamically. I thought this is probably better done in Launchbar due to Launchbar’s extensive and powerful indexing feature. In reality, it works much better in Launchbar. A support person in Launchbar built the Applescript code for me as this was definitely beyond my scripting capabilities. Launchbar can accept any number of Applescripts that you build for it, a well hidden fact.

The code for the workings of something that is basically identical in outcome between Alfred and Launchbar though is not always portable between the two as they’re drawing on different underlying areas to get the information. Regardless, the idea set off in Alfred prompted me whether this could be done in Launchbar and of course it could with tremendous results.

This last example though is not available to Keyboard Maestro as Keyboard Maestro doesn’t provide this kind of function. You could mimic it in Keyboard Maestro with Keyboard Maestro‘s own tools but I would say it’s not worthwhile. There is much that is very worthwhile to do in Keyboard Maestro but this isn’t really one of them. Regardless, there is much that is portable across all three and it’s definitely worth taking advantage of that as Applescripts aren’t the easiest things to build and get to work. The more you can reuse code by far the better.

Power Tools, Impressive Outcomes

All three of these tools are very powerful in their own right. Alfred gets most of its power beyond its core functions from scripts. Launchbar’s power is based on it’s very impressive index. And Keyboard Maestro‘s prime functions are through it’s extensive library of Macros that can pretty well do anything you want.

Although scripting and Alfred go hand in hand, all three programs benefit from the addition of scripting to enhance their core functions. My preference is to use and reuse Applescript simply because that is what I know (somewhat). Take advantage of Applescript however, when you’re working with any of these tools to enhance the function you’re trying to accomplish. Although the building of the pyramid may have it’s moments in time, you may be very pleased with the outcome.

Leave a Reply