• Tech Tips

    Keyboard Maestro – It’s the Little Things

    I’ve been using Keyboard Maestro to make myself more efficient. Even the littlest things can (and should) be automated to save time.

    I spend a good portion of my day navigating directories in iTerm. Often I find myself jumping up a directory (back) and then listing the directories to get my bearings.

    In about 30 seconds I made myself a quick hotkey that will be active during iTerm sessions (it’s within my iTerm group, which is only active for the iTerm application) and will perform both operations (cd .. and ls). I mapped this to CMD-u which I think of as “up” so it’s easy to remember. Notice there is a return (linebreak) after the ls; this will simulate hitting return, which will execute the preceding commands. I could have added a return keystroke action, but this is just faster and requires less actions.

    I encourage you, if you’re a KM user, to think about the little things and figure out where you could shave off keystrokes, mouse clicks, etc. to make yourself as efficient as possible.

    km-cd-ls

  • Tech Tips

    Determining Your Most Used Commands in Terminal

    I’m always looking to automate things using Alfred, Keyboard Maestro, Text Expander, and Python. I was curious which terminal commands I use most often, so I did some experimenting. Basically I wanted to know how many times I’ve executed each unique command ( ssh myserverx or ssh myservery, not just ssh). I started by piping the output of history to  sort (to group), then to  uniq (to count), then back to sort (to sort by the number of occurrences).

    Unfortunately, the result contained the same number of lines as the original history output. I figured this was because each line had a unique integer prefix (the line number in the history output). As it turns out, ~/.bash_history (where history gets its records) doesn’t contain line numbers. I simply changed the source and it worked like a charm:
  • Tech Tips

    Keyboard Maestro – Paste into Vim (with formatting)

    Vim users frequently run   :set paste  and :set nopaste . Using paste mode makes it simple to paste text while maintaining whitespace, but some other aspects of Vim are reset in paste mode (e.g., autoindent and smartindent). I’m sure there’s a way to make it easier to flip back and forth within Vim (via .vimrc), but if you want a universal way to do this, regardless of the Vim settings that are in place, you may find the following Keyboard Maestro macro helpful.

  • Tech Tips

    Keyboard Maestro – Alfred Integration

    alfredmaestroI’ve been using the Alfred Maestro workflow for a bit now. It’s very nice to be able to call Keyboard Maestro macros via Alfred.

    It took me some time to figure out why some of my macros weren’t available in Alfred.

    Make sure that if your macro group (or macro) is setup to be Available in the following applications that you include Alfred 2 in the list. Also, if you need the macro group or macro to be available in the KM built-in Trigger macro by name you should include Keyboard Maestro as well.

  • Tech Tips

    Keyboard Maestro – Simple GUI for a Command-line App

    Keyboard Maestro is now an integral part of my workflow throughout the day. I’ve found one particularly helpful use for it is to build very simple GUIs for command-line applications. In the example here I am showing how I use Keyboard Maestro to build a simple GUI for a Python script I wrote called dummyimage.py [see project on github]. Here’s the official description of the script:

  • Tech Tips

    Keyboard Maestro – Directory Prompt

    Keyboard Maestro seems to have every option I can possibly think of, with the exception of “Prompt the user for a directory” or “Prompt the user for a file”. It is entirely possible I’m just missing it.

    Here’s how I accomplish the directory prompt:

    km-prompt-directory

  • Tech Tips

    Keyboard Maestro – Star current track in Spotify

    I was exploring my options for starring the current track in spotify, but was coming up short. There is some work on some alfred workflows, but they either required a premium membership, or didn’t seem solid. It’d be nice to just use Applescript with a hotkey to star the track, but that’s not an action you can do with their library.

    I realized that I now have Keyboard Maestro, and this is just the tool I need to accomplish my goal (hit CTRL-CMD-ALT-S to star the current track). The macro is a combination of Applescript (to get current track details and whether or not it’s starred), mouse clicks (as clean as possible, should work for everyone), if-then-else logic, application activation and notifications.

  • Tech Tips

    Keyboard Maestro

    I’ve recently begun working with Keyboard Maestro and I’ve got to say, it’s one of the best applications I’ve ever used on a Mac.

    I’m always excited to automate things, though usually with Python scripts. I rarely used Automator because it seemed somewhat limited and I didn’t care for the workflow building tools. Keyboard Maestro is quite a bit more powerful, and very intuitive. I cannot even believe the level of detail on all of the events and actions. I’ll spare you the details and just have you visit their site.

    I’m going to create a new category on my blog for Keyboard Maestro macros, as I think you’ll be seeing a lot of them from me.