Latest in Automation

Image credit:

Keyboard Maestro on sale in Productive Macs bundle plus revised time tracking macro

TJ Luoma, @tjluoma

Before I get into today's main topic, I want to remind you that until November 18th, you can get Keyboard Maestro as part of the current Productive Macs bundle. For $30 you get seven apps, including Keyboard Maestro (normally $36) and another utility I highly recommend, DefaultFolderX which normally sells for $35. So you can get both apps for less than the cost of either – plus five other apps! Grab that bundle.

Now, as part of my quest to get people over the initial learning curve of Keyboard Maestro, I'm going to revisit Terminally Geeky Time Tracking via Screenshots and show you how I've made it much, much simpler.

A quick bit of background

It was a day like too many others: I was being pulled in a dozen directions and couldn't keep track of all my different projects. I knew I wasn't going to be able to remember everything I had worked on, and I was afraid I would forget to go back and finish something. A more organized person would have kept notes or put things into OmniFocus, but I needed something that required no effort from me to maintain once I set it up.

I needed someone to walk around behind me taking notes of the things I was leaving behind, or some way to leave myself a trail of virtual breadcrumbs to retrace my steps. Then it hit me: a Keyboard Maestro macro which takes a screenshot every 30 seconds. Review the screenshots at the end of the day to see where I spent my time, and make sure I didn't forget anything important.

If you want more detail, you can read the original post, or you can listen to Episode 71 of the "Home Work" podcast where I talked about it with my TUAW colleague (and "Home Work" co-host) Dave Caolo.

Mavericks broke the old version, but that's OK because this version is better anyway.

My original solution was called screenshot journal, and it was built around a shell script which could be called either by Keyboard Maestro or by launchd. That script was built around /usr/sbin/screencapture to take screenshots. Unfortunately, as of OS X version 10.9.0, screencapture does not work if you use multiple monitors. I suspect this will be fixed in a later version of OS X, but here's the good news: you don't need a separate shell script anymore.

As I mentioned in the original article, Keyboard Maestro was always the best solution, but I added the launchd method as an alternative, even though it wasn't nearly as good. Version 2 of screenshot journal is Keyboard Maestro-only, which means that not only do you get the original benefits, but it's now easier to install, configure, edit, change, and maintain. All you need to do is download the Keyboard Maestro macro and import it into Keyboard Maestro. There is no step three.

How to install the Keyboard Maestro macro

Adding my new Keyboard Maestro macro to your computer is very easy. Obviously you need to have Keyboard Maestro installed and running on your Mac. It comes with a free 30-day trial period, so if you haven't bought it yet, you can try it out first. Once you have it installed and running, simply download Screenshot-Journal.kmmacros by control+clicking on that link and choose "Download Linked File As..." if you use Safari or "Save Link As..." if you use Chrome (or whatever similar option your browser offers). Save the file as Screenshot-Journal.kmmacros

Note that Safari may decide to name the file Screenshot-Journal.kmmacros.txt If so, just change the filename so that it ends with ".kmmacros" and if a dialogue appears asking you to confirm the change, select the "Use .kmmacros" button, as shown here:


Once the file is properly named, double-click it and it will automatically import into Keyboard Maestro. Boom! Done.

What it does and how it works

At its core, all this macro does is take a screenshot and save it. Everything else is details. Then again, depending on who you ask, God, the devil, or delight is in the details, so they aren't to be overlooked. So, while you keep that core idea in mind, here are the details:

  • Each screenshot has a unique name, and that name starts with the current time, in 24-hour format. That way you can easily sort an entire day's worth of screenshots in the Finder and retrace what you did. The filesystem does not like colons in filenames, so I use "." instead. For example, if a screenshot was taken 7 seconds after 3:22 p.m. the filename would start with 15.22.07.

  • The macro will run every minute that you are logged into your Mac, starting at 6:30 a.m. and ending at 11:00 p.m. (You can easily change the starting and ending times, as well as how often it runs, just by clicking up and down arrows in Keyboard Maestro.)

  • The macro will also run anytime you press the keyboard shortcut: Option/Alt (⌥) plus shift plus 3 (Note that there is no command (⌘) key.) You can easily change that keyboard shortcut in Keyboard Maestro, or set it not to have a keyboard shortcut at all.

  • Last (but truly not least!) the macro will run any time a new application activates. For example, if you are using BBEdit and then press ⌘ + Tab to switch to Finder, the macro will take a screenshot. I added this because I realized that no matter how short the interval was between the macro automatically running, I might briefly switch to another app, do something, and then switch back to the original app. The only way to catch that was to run every time a new app was activated. This also allows you to set a higher interval between timed execution of the macro. (You could even disable the timed execution altogether and only have it run when a new app activates, but I don't recommend that because you might switch tasks within the same app. For example, maybe you started our reading your Gmail, but then you clicked a YouTube link and spent the next several hours reading Wikipedia. If you only took screenshots when you switched out of Safari, you could end up with an hours-long gap that shows you were using your web browser, but without showing you what you were doing in it.

  • On the other hand, if the computer has been idle (meaning no keyboard or mouse/trackpad input) for more than 2 minutes, the macro will not save a screenshot. Chances are that you have stepped away from your Mac, and a new screenshot would be the same as the previous screenshot. (Instead, an empty text file is created with a special name so you can see that the macro ran but found the computer idle.)

  • Also, if the screensaver is running or if the screen is turned off, the macro will not save a screenshot. (Instead, an empty text file is created with a special name so you can see that the macro ran but found the screensaver running.)

  • If you use more than one monitor, Keyboard Maestro will screen capture all of them into one image file.

  • Image files are saved as GIFs by default, but you can easily change that within Keyboard Maestro just by selecting one of the options in a drop-down menu. (Note: in my testing, JPG screenshots were more than twice the size of GIFs, and PNG screenshots were almost three times the size!)

  • All screenshots are saved to ~/Pictures/screenshot-journal/ but you can choose a different folder if you wish. Sub-folders are automatically created for each day, so (for example) all of the files created on November 8th, 2013 would be saved to ~/Pictures/screenshot-journal/2013–11–08/. Collecting them into dated folders makes it easy to sort them in the Finder, and you can easily trash screenshots from previous days if you no longer need them.

  • The image filenames also show 2 other pieces of information: 1) the name of the active application at the time the screenshot was taken and 2) the name of the active window in that application (if one exists). That way you can easily look through the filenames and get a rough idea of what you were working on. For example, my most recent image filename is "22.13.59.MultiMarkdown Composer (screenshot-journal–2.mmd).gif" which tells me that at 11:13:59 p.m. I was working on a document named "screenshot-journal–2.mmd" in MultiMarkdown Composer.

  • If you decide that you do not want to use this macro any more, simply disable it by selecting the macro in Keyboard Maestro, and then choose the menu item: View » Toggle Enable, as shown here:

Keyboard Maestro menu to toggle enable

If you change your mind want to try it again at some point in the future, use the same "Toggle Enable" menu option when the macro is selected in Keyboard Maestro.

Final thoughts

If you are worried about CPU usage of something like this running every minute, all I can tell you is that I never notice it on my 2010 MacBook Air.

This macro isn't fancy, and it doesn't do any analysis. That isn't what it was meant to do, but if you want a Mac app that can do that, checkout Time Sink from the great folks at Many Tricks. You can try it free for two weeks, and then buy it for $5 from the developers or from the Mac App Store As always, I prefer to buy direct. The money goes directly to the developers, you get faster updates because you don't have to wait for the Mac App Store approval process, and you don't have to worry that Apple will change the Mac App Store rules (again!) so that apps no longer work or have to remove functionality.

(If Time Sink isn't what you are looking for, several people have recommended Rescue Time to me. I haven't used it yet, but they have a free version which you can sign up for without any credit card information.)

It should go without saying that there are some minor security and privacy issues that go with using any sort of automatic time tracking program. If someone else can access your Mac, they could look through your folder of screenshots and see what you've been doing all day. That being said, if someone has access to your Mac, you should either trust them enough not to worry about them snooping around, or you should use a short screensaver timeout and require a password to unlock it.

This macro has been very helpful to me. It can be a bit intimidating or even scary at first, but being able to trace back through my day and see where my time went has proven to be useful time and time again.

From around the web

ear iconeye icontext filevr