Keyboard Maestro Automation

More automation on the Mac

Keyboard Maestro Automation is great and I do love a bit of automation on all of my computers. I can’t help but love all the stuff I can do on iOS using Shortcuts application. So when I get working on my Mac I want to do the same sort of thing. The application Automator has been around for a long time and you also have AppleScript. I haven’t got into either of these applications much and I find I much prefer to use Keyboard Maestro. It just seems to be more accessible and more reliable. So when I have a problem to solve I’ll go to Keyboard Maestro before I look anywhere else. Something which will be really nice is if we had the Shortcuts application for the Mac. Given its success on iOS and the move towards iOS applications being compiled for the Mac with what Apple are calling “Marzipan” I can see that happening in the future.

Finding a problem to solve

You have to choose what it is you want to automate. This can be easy and it can be hard. The problem is we are so busy we are doing what we need to do and not remembering there are automation possibilities. It’s like when you’re cutting down a tree with a blunt saw and you’re too busy mopping the sweat from your brow to use the saw sharpening tool you have in the bag. Sometimes I think it would be a good idea to have a Post-it note posted front and centre on the computer to remind you. The note would say something like “Can you automate that?” or “Are you doing a task of repetitively?” We have something like this built into TextExpander which lets you know if you are consistently typing in a specific word over and over. A little message pops up to ask you if you want to create a shortcut. So I thoroughly recommend you doing whatever it takes to give yourself a reminder every now and then to look at your workflow.

My latest Mac automation

First of all I had to notice there was a problem which needed to be solved. I like to work on my Apple computers as if they are one big system. I need to have access to words I’ve written on the iMac when I’m away from home and I only have my iPhone or iPad with me. Same with going the other way and anything which I did on the iPad or iPhone should be available immediately and easily on my Mac.

iCloud or Dropbox

I used to use Dropbox as the service to synchronise files across the whole system, iOS and OS X. At the moment I have a problem with Dropbox not working for me properly on my Mac and so writing I’ve done in Scrivener can’t be synchronised. I’ll have to get the connection with Dropbox fixed at some point in time. On the other hand, I do have a preference for using iCloud and any writing I do on the Mac in Ulysses or Drafts is immediately synchronised to all my computing devices.

Where to do dictation – Which app?

I like to write in Scrivener because it accepts the dictation from DragonDictate just perfectly. If I try to do the same in Ulysses it will throw up errors and complain after a while. So what I do is to write in Scrivener and send that text to where I can use it everywhere. When I start the day I like to do a journal entry into Day One. I write this journal entry in Scrivener and then I have a Keyboard Maestro automation which select all of the text, copies it to the clipboard, opens up Day One, inserts the password as it opens up the application, starts a new journal entry and pastes the clipboard contents. I have also set it to close the application Day One after a few seconds. This gives me a chance to make sure the post has been posted correctly. It’s also enough time to drag in a photo from Photos app if I wanted. All I have to do to get this automation started is to type in two characters – d1.

Scrivener to an iCloud synchronised app

So my plan was to do the same type of automation which takes my text from Scrivener and puts it into an application which synchronises through iCloud. My first thought was to send it to Ulysses. Ulysses is a fantastic writing application and I have used it to write, organise and compile complete books which I have for sale available on Amazon and the Apple bookstore. It uses iCloud for the synchronisation and it has never let me down. If Dropbox was working for me on my Mac – Scrivener Dropbox synchronisation doesn’t work great. You have to wait a short while for the synchronisation to do its thing when you open up the iOS version of the application. It is just a little niggling problem, but it has led me to find other ways to complete my writing workflow.

Drafts the Text Editor / Automator

Another option is to use the application Drafts as the receptacle for my dictation on the Mac. I have given it some testing and so far it seems fairly reliable. Even so, for the moment I still prefer to use Scrivener for my dictation. Drafts on the Mac is still in beta although that is due to change fairly soon. As soon as I have the full version of the application I will look again at my writing workflow on the Mac. I think Drafts could work well for me especially as I’m able to increase the size of the text. My old eyes prefer to have the text of bigger on the screen and make it easier to read. No need to have an extra step in the process, but for the moment….. Let’s automate. – Keyboard Maestro Automation

Creating a Keyboard Maestro Automation

There is a feature in Keyboard Maestro Automation which lets you record your actions, clicks and keyboard presses. So one way to create a new automation is to press record and see what you have at the end. If you’re using your mouse or Magic Trackpad the recording will record where you click on part of the screen. The problem comes round when you’re running the automation later. The application could be in a different part of the screen and the click to do something is not in the right place. It’s for this reason I prefer to use keyboard key combinations. So it’s a good idea to have a look through the menus and make note of the key combinations to operate the application. You can also get Keyboard Maestro to activate buttons in an app window. We all know the keyboard combinations for working with the clipboard whether we want to cut, copy or paste. You only have to work out if there are other keyboard combinations you need for your automation specific to the application.

Dragging and Dropping Actions

After you’ve created a new macro in Keyboard Maestro you can give your new macro a title. Then you can specify what your trigger is going to be and you have a lot of choices available. The one I wanted to use was a Typed String Trigger. It’s handy to use one of these because your fingers are already at the keyboard. Choose something you’re unlikely to use during ordinary typing such as d1, n1 or xxx or something similar. (Another possibility is to use a keyboard combination as a macro trigger.) Then start adding actions you want in your macro. You start this process by clicking on the green coloured round button with a + in it. This brings up a list of actions available.

Keyboard Maestro Automation

Finding Actions in Keyboard Maestro

Actions are grouped to help you find them and you can also do a search. There are three smart folders for actions – All Actions, Favourites and Third-Party Plug-Ins. After that there are a number of folders you can look into depending on whether you’re working with images, text, files, web and a range of others. There’s a reasonable number of actions available. You can even run other macros, execute AppleScript or JavaScript as well as control the flow of macro with programming type statements.
To help you get started it could be a good idea to run through what is you want to do manually. Then you’ll see easily what is you need to add to your macro to recreate it as an automation. Here’s a list of what I wanted to do with Keyboard Maestro Automation.

  • Select all text
  • Copy the selected text to the clipboard (or cut)
  • Open the application where I wanted to move the text to
  • Create a new document
  • Paste the clipboard contents
  • Cleanup the text
  • Add tags to the newly created document
  • Return to the application where I started – Scrivener

I needed to clean up the text because there was extra space in front of the ## at the beginning of the dictated text. I needed to do a find and replace to specifically remove that extra space. I experimented with doing this cleanup before copying it to the clipboard and also after pasting into the secondary application. I found it worked better after pasting. Sometimes you need to do some tweaking to get these macros to work. On a couple of occasions I’ve needed to add a pause of a couple of seconds to make sure the computer had time to complete the action. Keyboard Maestro is a super application for automating your day to day work on your Mac.

Keyboard Maestro Automation

Keep iterating and testing

When you have something which looks like it has all the steps, press the play button and give it a try. Or stop the editing process of the macro and go to the application where you want to use it. Test the macro and also the Typed String Trigger. If everything works as it should, give yourself a pat on the back and be happy. Sometimes you have to change something in the macro to make it work. Other times you can see how you could improve the macro and you’ll want to throw in more actions. It is fun to make these macros and satisfying when you have created a tool for yourself which saves you time with your repeating tasks in your workflow. Go and have fun making your macros. Let me know in the comments if you have made a good one. Let me know if you need help and I will do my best to point you in the right direction.