Tag: keyboard maestro

Keyboard Maestro: An Almost Invisible Superhero of Productivity

a person typing on a keyboard
Photo by Florenz Mendoza on Pexels.com

There are some tools that I use that are so seamlessly integrated with my workflow that they are almost invisible. They work so well that I simply don’t think about them. That really isn’t fair since tools like these do far more than they get credit for. And since I had a particular tool in mind today, for reasons I will explain, I thought I’d write about one such invisible superhero of productivity: Keyboard Maestro.

Keyboard Maestro is made by Stairways Software and it is Mac-only. If you are a Windows users, you can read with envy. If you are a Linux users, you probably don’t need a tool like Keyboard Maestro in the first place.

I have been using Keyboard Maestro for just over 8 years1 and I’m not sure I can quantify how much time it has saved me. Keyboard Maestro is an automation tool that combines three useful functions in one:

  1. Text expander
  2. Clipboard manager
  3. Automation engine

I think I first began using Keyboard Mastro as a substitute for TextExpander in order to get the expansions that I wanted. Keyboard Maestro can do text expanding, but even there it is powerful. It can take a simple expansion like ;;email and expand it to my email address. Honestly, I can’t remember the last time I had to type out my email address. Quite possibly it has been years. Like many text expanders you can set one phrase and have it expand to another.

But it can do more. It can perform transformations on the data. I wrote about a fairly simple version of this when I described how I used Keyboard Mastro to automatically add the next entry number to my journal in Obsidian. I have all kinds of useful text expansions and they have become so innate that I don’t even notice them. It would be fascinating to know just how much typing Keyboard Maestro has saved me over the years (and how many typos it has prevented).

Keyboard Maestro also serves as my clipboard manager. I am constantly copying things to the clipboard and pasting them other places. Keyboard Maestro keeps a history of my copies and allows me to access that history when I paste. Here is a glimpse of what that clipboard history looks like at the moment:

an image of my clipboard history in keyboard maestro, showing the last 5 copies I made, all ready for pasting

In addition to containing text, the clipboard can contain images. And when I paste something from the clipboard, I have the option of transforming it as I paste. Examples of this transformations include:

  • changing the capitalization of the text (all caps, all lowercase, title case, etc.)
  • manipulating an image by flipping it, rotating it, changing its size

This takes a lot of manual effort out of routine and reptitive tasks.

It was this clipboard history functionality that got me thinking about writing this post. I occasionally made use of PasteBot for this, but recently decided to consolidate this functionality into one app–much as I did with TextExpander. And since Keyboard Maestro does this so well, that was what I went with.

Keyboard Maestro can also do all kinds of automation, something I have only experimented with lightly over the years2, but something I am interested in making more use of.

As I said, Keyboard Maestro works so well, it is virtually invisible. I often forget I am even using it when I am typing. So I wanted to call attention to it, because it really is a powerful, useful, time-saving tool.

Written on March 11, 20223.

Did you enjoy this post?
If so, consider subscribing to the blog using the form below or clicking on the button below to follow the blog. And consider telling a friend about it. Already a reader or subscriber to the blog? Thanks for reading!

Follow Jamie Todd Rubin on WordPress.com

  1. I just verified this, going back through my email to find the receipt from my first order, dated March 3, 2014.
  2. For an example, see how I used Keyboard Maestro, years ago, to automate pulling notes and highlights of my Kindle. I don’t use this automation anymore, but it is a good example of what is possible.
  3. Yes, even this dateline that you see at the end of each post is generated by a Keyboard Maestro macro that I created

Automating My Journal Entry Numbers in Obsidian with Keyboard Maestro

colorful toothed wheels
Photo by Digital Buggu on Pexels.com

Not long ago I wrote about how I went back to keeping my journal in Obsidian. I was going to try this experiment for all of 2022 to see how it worked out. I’ve flip-flopped on this over the last year or so, but you can check out the recent post as to why I made this decision.

Since I began this particular incarnation of my journal, back in 2017, I began giving each entry a unique entry number. I took this idea from Isaac Asimov, who used a similar method to simplify the indexing his of book Asimov’s Biographical Encyclopedia of Science and Technology. The journal spans multiple volumes (9 large Moleskine books and now, one file) and the entry numbers allow me to index the journal without worrying about which volume or page number the entry is on.

I am always looking for small efficiencies in workflow, and as I have been keeping my journal in Obsidian, I wondered if there was an easy way to automate entering the next entry number heading. It’s a small thing, but given that the journal is a text file, and each entry number a level 2 heading, it should be do-able. Here is how I managed to automate this:

Obtaining the next entry number

First, I wrote a command to search my journal file for all level 2 headings (that is, heading that begin with ## in Obsidian) and are followed by a numeric sequence. A typical heading entry looks like this:

## 2345

It took about five minutes of messing around with some Unix commands to do the trick. Here is what I came up with:

egrep "^##\s(\d+)" ~/Documents/DFC/Writing/Journal/2022\ Journal.md | tail -1 | sed 's/## //'

Running this command returns the number part of the last level 2 header in the journal file. For instance, when I run it right now, it returns: 2155

Here is how it works:

  • egrep "^##\s(\d+)": searches for any lines in the file that begin with ## followed by a space and then a sequence of one or more digits. Since ## 2155 matches this pattern, any lines in this format will be returned.
  • ~/Documents/DFC/Writing/Journal/2022\ Journal.md: the name of the file to search. That is, my current journal file.
  • | tail -1: take the output of the egrep command about, which will be a list of all the heading level 2 entry numbers in the file (like ## 2155) and filter it through the tail -1 command, which returns the last item in the list.
  • | sed 's/## //': take the last heading that comes from the previous command and filter it through the sed command to strip out everything but the number itself. What I am left with after this is just the entry number.

Getting the entry number into Obsidian

I use Keyboard Maestro for a lot of text expansion and miscellaneous automation. I decided I could use it here to get the entry number into Obsidian. I created a Keyboard Maestro macro called “New Journal Entry” that is triggered whenever I type ;;dd. (Note, this doesn’t apply to just Obsidian, it will do it when I type that sequence of keys anywhere.) The following macro is run when I type that key combination:

Here is how it works:

  • first, it executes the Unix command discussed above to obtain the next entry number from the file, and stores the result in a variable called CurEntry. If I ran this right now, the value of CurEntry would be “2155”.
  • next, it increments the value of the CurEntry by 1, making it 2156.
  • finally, it prepends the number with ## and inserts the value at the position of the cursor in the document. Keyboard Maestro automatically handles replacing the triggering text (;;dd) with the inserted value.

Here is what it looks like in action:

This might seem like a lot of effort to type out a number, but keep in mind, it took less time for me to create the automation than it did to write this post. Also, I’ve already got more than 2,100 entries in my journal and each time, I find myself having to check the previous entry number before entering the new one, and occassionally, I make a mistake, which is a nuisance to correct. This little macro eliminates all of that.

Perhaps even more important, it is one less thing I have to think about. Instead of sitting down to journal and first having to figure out the entry number, now I can just start writing.

There are probably other tools that could be used to achieve the same results. I’ve just happened to be a Keyboard Mastro user for a long time and have a cache of automations that I’ve created over the years stored there, so it seemed the logical place for this one.

Written on February 13, 2022.

Did you enjoy this post?
If so, consider subscribing to the blog using the form below or clicking on the button below to follow the blog. And consider telling a friend about it. Already a reader or subscriber to the blog? Thanks for reading!

Follow Jamie Todd Rubin on WordPress.com