Be a master with a few keystrokes

No mater what you do, develop, design, use whatever the task on hand, there are times when you might go, Aaah, wish I did not have to do this over and over why can I not automate this?

Automation Options

When working on a Mac, Apple offers the users with built-in apple script, this can be used to tell your applications to do something. Apple script is free, but there are issues like the fact that Applescript is usable only with the applications that can be scripted. So many apps that you would be using on a regular basis and made by Apple are suddenly out of reach or not scriptable.

When Windows 3.0 and 3.1 were released, Microsoft had an app called Macro Recorder, and the Win API had functions that had CBTHooks, these were really useful for creating training apps over existing apps. So you could want the user to perform a particular task rather than click on any menu option, with CBTHooks you could restrict that. Anyways, the API's have disappeared, the app called Macro Recorder has disappeared, this was quite useful as it would record everything, including keystrokes and mouse moves.

Well, we are nearly about 20 years since and there is an apparent lack of that type of program. There is an opensource initiative called AutoHotKeys, but what about Mac users?

Keyboard Maestro

What is Keyboard Maestro? When we got a copy for review, which was a while ago, it was difficult for us to really determine what the true power and potential of this app was. It wasn't like other apps that addressed an explicit requirement. It took us a while to really comprehend the power of this app and over this period, the true power of Keyboard Maestro has been really dawned to us enabling to base this review more so on personal experience.

1. So what is it?

It is an app for the Mac OS X that provides powerful functionality in a way similar to a macro recorder/scripter, in fact the scripts are referred to as macros and the way to create these scripts is totally GUI based. If you have worked with Automator, the interface is similar.


How does it work?

Each macro/script has a name to be identified, it can be enabled or disabled and could have a hotkey to trigger the macro. The trigger can be triggered in a variety of ways. The most common one being keystrokes/hotkeys.

Some other methods include
* When a particular string is typed and can be set to match the case. The string can be deleted and the macro triggered.
* What an application has a state change, like Launch, Quit, Activate, Deactivates, isActive, isRunning. This can use any app that can be run on the system.
* At system wake
* At Login
* At Time (like cron) and the days can be set when to check for this time to trigger the macro
* While logged in
* When the palette is clicked (a floating toolbar with macros)
* When the status menu item is selected
* Public Web Server Entry
* Device Key pressed
* MIDI Note pressed
* Hotkey, which can have all modifiers and can be either of the states, Down, Released or Pressed

Now these triggers can be chained together for complex conditions.

One can also use scripts to trigger the macros, which can be written as AppleScript, PerlScript, PythonScript or ShellScript. This mainly relies on the applescript type format of calling the osascript utility to execute 'tell "Keyboard Maestro Engine" to do script "the script name"'




How to create the script/macro?

A script/macro is made up of one or more actions. There are quite a few actions available with Keyboard Maestro and they are categorised for easy use. So for example the Execute category has
* Execute an Applescript
* Execute an Automator Workflow
* Execute a shell script
* Execute a macro

Under the Interface Control, there are options like
* Manipulate a window
* Move or click Mouse
* Select a menu item
* Press a button
* Type a keystroke
* Simulate Scroll Wheel
* Use a variable

Just looking at the variables option under Keyboard Maestro is so powerful, plus add to it the commandline utils that MacOSX offer make it a very powerful macro editor.

For those that do not wish to build the macro by dragging and dropping the components, there is the record functionality, which records the actions of the user and creates a macro based the actions, mouse clicks, menu selection, text typing, etc.

Is this expensive?

This is one question that many users ask and it is quite valid given that the cost of apps are now expected to be quite low in comparison. However Keyboard Maestro is a dual app, a 2 for the price of 1 type app. It is a macro recorder but it can also perform just like TextExpander and TextMate, this is not the sole feature of Keyboard Maestro, but it can manage/handle the strings quite well. Given that the pricing of this app is in the same range as others, and that this has double the features, this is value for money any day.

Practical uses

There are many practical uses for this app, however in a particular scenario, we were faced with rotating a set of images left and also saving a copy that was smaller, about 40% as a different file format. This was something that was very often resolved with using IrfanView, a freeware app for Windows. On the Mac preview would be used to help achieve this. However Preview is non-scriptable, Automator cannot work with Preview. So using Keyboard Maestro was the only option and what a simple, yet powerful option it turned out to be.

The steps are simple
* Open Finder Selection with |Preview.app|
* Type the ⌘+L (Rotate Left)
* Pause for 0.5 seconds
* Type the ⌘+S (Save)
* Pause for 0.5 seconds
* Type the ⌘+W keystroke

to add the resizing bit, it is equally simple and requires the addition of the "select a menu item" which populates the entire menu to select from.

Resizing is as simple as

Activate Preview.app
Select 'Adjust Size...' in the Tools menu
Pause 0.2 seconds
Insert 50 by typing
Type the return key

There are many macros shared by other users which can be used. One notable one is the PC Switcher's Pack which maps the keystrokes for the PC type keys to the Mac type keys, so where PC users are used to the ^C, ^V, these keystrokes are mapped to ⌘C and ⌘V.


summary

This is one app that has functionality written all over it. Despite the mac osx platform being quite usable and scriptable via scripts be it shell, apple or python or perl, there is a lack of functionality in other apps, including applescript and automator, and not to mention the hassle of learning a new language or syntax and then finding that half the things do not work. Keyboard Maestro is on the other hand a very simple, and easy to use macro recorder and can be played back easily without any issues. In fact the macro can be integrated with a script or another macro to provide more flexibility.

The app can be purchased off the website or via the App Store.

SUMMARY
Software : Keyboard Maestro
Version : 5.0.3
Publisher : Stairways Software Pty Ltd.
Website : http://www.keyboardmaestro.com/
Twitter : @keyboardmaestro
Platform : Mac OS X (10.6.x or higher)
Demo : ?? days
Price : $36

Mac App Store : http://itunes.apple.com/us/app/keyboard-maestro/id406298247?mt=12

Comments