Keyboard Maestro is a powerful Macro programming environment for the Mac and OSX. In “Hypercharging your Mac with Keyboard Maestro 6” I outline the attributes the current version of Keyboard Maestro brings to the table to add to an already very powerful system. In this article and other articles at “the Daily Mac View” I outline the capabilities of Keyboard Maestro. For the purposes of this article, I won’t spend but a little time on Keyboard Maestro’s specific power. Rather, this article will discuss the use of embedded Automator and Applescript routines directly in Keyboard Maestro. To those who want to automate their Mac but to the highest level, nothing can replace Keyboard Maestro.
Keyboard Maestro Itself
To provide a brief overview on Keyboard Maestro, this macro program can almost do anything you need done to automate your Mac especially where it comes to highly repetitive tasks. The product provides a variety of triggers all of which can invoke an action or sequence of actions. The hotkey is the most common of the triggers. So something like F1 might launch your favourite program.
I have two types of triggers which I use extensively, the second of which I employ liberally as I have over 200 macros. I use the hotkey for my very most used actions. You can also have what is called a Palette of hotkeys to invoke an action. Using a palette you can have a trigger, such as ctrl-l list a palette of potential actions such as programs to launch. So ctrl-l could bring up a palette and in your palette you’ve got listed various actions, such as launch Safari, so by pressing S, as an example, Safari launches. There are a variety of other triggers so Keyboard Maestro gives you a rich variety of methods in which to trigger an action.
There are numerous actions which can be sequenced together to produce complex actions. There are so many actions pretty well anything can be done. In fact, you can create your own actions, referred to as plug-n actions, to create anything not found in Keyboard Maestro if you can think of anything. Since there are so many actions then you might wonder then why would you need Automator or Applescript.
Why Automator or Applescript
The answer to this is sort of straightforward and not. There are different reasons why you might want to employ Automator or Applescript in a Keyboard Maestro routine. One of the simplest reasons you might want to use Keyboard Maestro with either of the two is just to invoke them with Keyboard Maestro’s variety of triggers. However, this still begs the question.
In reality you probably could do most things you want to do just using Keyboard Maestro however, using either Automator or Applescript might and in most cases when you decide to use it will produce a result more efficiently.
As a quick example, let’s say you have someone you email all the time. You can have a Keyboard Maestro script create a new message, fill in the various fields that always get filled in and then complete your email. However, with Automator, this process can all be encapsulated in one Automator routine which when run produces the result immediately without a lot of action happening on the screen. Thus, Keyboard Maestro is used to invoke the Automator routine but Automator produces the result. It’s just more efficient than having Keyboard Maestro do all of that.
Automator or AppleScript for Efficiency
So one of the primary reasons you might use Keyboard Maestro with Automator or Applescript is just to simply invoke one or the other with any of the many Keyboard Maestro triggers. This is a very good reason. Automator or Applescript are not really that easy to invoke. Keyboard Maestro makes either very easy to invoke.
However, I would say that the primary reason you would use Automator or Applescript rather than Keyboard Maestro to produce a result is it’s more efficient to use in a Keyboard Maestro routine as either it’s own routine or a subroutine within Keyboard Maestro than the Keyboard Maestro routines. However, this comes with one caveat. This is only true if you know how to create Automator or Applescript routines. If you don’t learning them is not a cake walk. This holds far more true for AppleScript than Automator. So in this event if you know one and not the other you might just use that one. If you know neither it might be useful to learn one of the two or just use Keyboard Maestro solely.
For myself, I like to use both Automator and Applescript routines in Keyboard Maestro. However, I am not a scripter. I know Automator far better than Applescript and will lean towards that solution however, I do know Applescript somewhat or I might know of it’s capacities. Knowing this, I might then decide it’s beneficial to at least learn how to do this component in Applescript.
To Extend Keyboard Maestro’s Functionality
One might say that the above is in some ways extending Keyboard Maestro’s functionality. I tend to think of the above as augmenting Keyboard Maestro’s functionality.
Automator or Applescript can rightly extend the functionality of Keyboard Maestro. To be more accurate, Applescript can really extend Keyboard Maestro’s functionality more so than Automotor whereas Automator and Applescript can definitely augment Keyboard Maestro’s functionality.
Applescipt can not only extend an applications functionality but you can build Application functionality with Applescript. As an example, using DEVONthink Pro Office you can use one of their Applescript’s to take a note, jump out to the Reminder’s application The Hit List and insert a new Reminder linked back to the note in DEVONthink. This is powerful and fast. I could likely do this with Keyboard Maestro but it would be tricky. The script is already, along with many others, built in DEVONthink so I just use what’s built but control it from Keyboard Maestro. In fact, I use Keyboard Maestro to control every one of my active Automator routines or Applescripts.
So in this way, Automator and Applescript are extending the functionality of Keyboard Maestro. I’m using Keyboard Maestro to control all aspects of this operation but I’m extending Keyboard Maestro’s functionality. Further, I can embed these Automator or Applescript routines within a Keyboard Maestro routine. I might just have Keyboard Maestro “wait for” the subroutines to finish or finish as the subroutine does. Regardless, I’m using Keyboard Maestro to control Automator or Applescript.
Keyboard Maestro’s Power is Extensible
Keyboard Maestro is not only an extremely powerful macro programming utility on its own but its power is fully extensible. You can run full Automator or Applescript subroutines from Keyboard Maestro and as I said I only run either my Automator or Applescript routines from Keyboard Maestro.
To give you yet one more example, I have two classical iTunes radio stations I love listening to. My full iTunes environment that I’ve automated is run via Keyboard Maestro. In this example, I have Keyboard Maestro draw a menu of choices two of which are these channels in iTunes that are played via a playlist. To get Keyboard Maestro itself to go out and choose the playlist would be challenging. It’s very simple in Automator. So, of all the items you see in the menu these two items are invoked via Automator and everything else is via Keyboard Maestro. To you as the user though this is transparent. However, it is much more than this. You’ve basically enabled Keyboard Maestro’s extensibility and thus efficiency. You’ve chosen the fastest, easiest route to do what you want.
Will keep growing with you
Just as you think you’re getting to know Keyboard Maestro more will jump out at you to allow you to this or that. Just as you’re beginning to think you are beginning to master Keyboard Maestro you’ll find your mastery can keep growing.
Keyboard Maestro will keep growing with you. There really is so much you can do with this product to automate your Mac. Between Keyboard Maestro’s own triggers and actions and it’s extensibility using Applescript or Automator and did I mention….
I have often said this is one product I could not do without and I could not. I love say Launchbar and Alfred but if I had to make a choice of one of the three products I would always choose Keyboard Maestro.
I can easily and confidently say this. Keyboard Maestro is a small investment with a huge return. It simply can do so much. I would not say that this is the easiest product to learn. However, if you approach it properly you will soon master, as you go a long, what you need to master. The product simply grows with you. So start with something simple like inserting some text in a field or launching an application or file. Take it one thing at a time and add to your repertoire as you feel comfortable. Unless you’re already a programming ninja, jumping right into Keyboard Maestro to run Automator and Applescripts would only make sense unless you were a master of those in the first place.
Just know that this kind and level of functionality is available to you when you’re ready for it and need it. Personally, I love being able to invoke either Automator or Applescript from Keyboard Maestro. I’ve functioned with this for so long I often don’t realize that I’m working with this within the OSX environment. It does become second nature to you and it’s something that once you’ve become used to it you will not be able to do without.