Sunday 15 March 2009

Don't repeat: Automate


There is almost always a way to do something on a computer, but it often requires a bit of experimentation. Once you do find a solution, then it often involves quite a lot of clicking around. Menu shortcut keys can help a bit, but for tasks that you are going to do a lot, then you need to automate.

I've been a long-term fan of automation. I know that the animated diagrams in my first CD-ROM for my 'Sound Synthesis and Sampling' book definitely could not have been done without AppleScript and KeyQuencer [Dead link inside. For historical record only. Sorry]. It is a great shame that Alessandro Levi Montalcini's KeyQuencer did not make it to OSX, and that the binarysoft web-site domain has now been taken over by a generic software company that could not be more different to the one that produced KeyQuencer. I'm not including a link to the new binarysoft domain because it really isn't relevant at all...

So when Cali Lewis's engagingly wonderful Geekbrief podcast featured Apple's laconic Sal Soghoian talking about AppleScript and Automator recently, it reminded me that I hadn't found an alternative to KeyQuencer. So I did some more research...

And I found Keyboard Maestro!

Why do I need another piece of automation software for Mac OSX when I've already got the bundled AppleScript and Automator? Because long experience has taught me that there's always something you can't do easily in just about any automation software, and that you need more than one to be able to solve all problems.

For example, I wanted to be able to sort out folders full of various versions of files, all with similar filenames, but with various different endings. The kind of loose fragments that tend to accumulate when I'm writing a book. Because these aren't organised formally, then most automation won't work, but what I wanted was something that would let me select the first part of the filename, and turn it into a folder with that name, so that I could then move the fragments into that folder and hence, organise all my jottings.

I tried Automator, and couldn't figure out how to move the contents of the clipboard into a folder name. If Automator doesn't provide the fields to do something, then there's not very much you can do about it. In AppleScript, there's a different problem. But Keyboard Maestro made it very easy, and in just a few minutes of experimentation, I had an F7 key that now creates folders using selected text from a filename.

This general principle: 'if you can't do it one way, try another', is one of those engineering solutions that has been with me from a very early age. This might be why I fill hard drives with software Tools and Utilities...

I'm also very aware that it may well be possible to do this example (and many other tasks) in AppleScript and Automator and... But this often requires time and knowledge, and if I find a quick solution in an alternative then that is fine by me. If anyone wants to share alternative solutions then that will be warmly welcomed and publicised here in this blog!

No comments: