• Tech Tips

    Bookmark with Dynamic Components via Keyboard Maestro (with Toggl Reports example)

    Here’s an example of how you can use Keyboard Maestro to create bookmarks that use dynamic components. For this example I wanted to create a bookmark that would give me the correct URL to get a report of the last 365 days of Toggl time entries. Toggl lets you pass a start date and an end date in the URL. Using KM it’s easy to replace those values with calculated date values.

    Click the screenshot at the right to see the macro, which I’ve also provided here: Toggl entries for the last 365 days.kmmacros.

  • Tech Tips

    Microphone Enable/Disable with Alert – Keyboard Maestro Macro

    In the past I’ve used Shush to achieve a push-to-talk or push-to-silence setup on my Mac. It works alright but more often than not I forget which mode I’m in, or whether I’m silenced or not. This leads to awkward moments in meetings.

    I’ve solved the problem using Keyboard Maestro. This macro, triggered via CTRL-m simple enables or disables the current “input” device (whatever is selected in the Sound preferences) by setting its level to 0 or 100. It’s a toggling macro so you can use the same hotkey to flip between the two states. Most importantly, though, is the nice popup alert that appears when you go into “disabled” mic mode. This window is hide-able if it gets in the way, and it also disappears if you re-enable (via hotkey OR the RE-ENABLE button). You can safely disable the “Custom HTML Prompt” action if you don’t want to see the prompt. Here’s what the popup looks like:

    MicDisable

  • Tech Tips

    Random Mouse Distance in Keyboard Maestro

    Here’s one way to choose a random item in a select list using just mouse movements and a random number. If you’re trying to do this in a browser there are cleaner ways to do it (javascript, chrome/safari actions, etc.), but for general usage across many applications this is a pretty universal solution.

    2016-03-03_20-04-27

    I was surprised to find that you can type variables into the tiny coordinate text fields. They get bigger when you do.

    When executed, this will select a random item (excluding “- None -“) from the select list.

  • Tech Tips

    Use Keyboard Maestro to Hide Instead of Close an Application

    I use SnagIt to capture screenshots. The editor window that appears after you capture takes a few seconds to open if the application isn’t running. I realized that, while the capture tools remain open, the editor goes away when I hit ⌘W to close the window. Instead of using ⌘W to close the editor window, I sometimes remember to use ⌘H to hide the window, which hides the window but leaves the application open. The editor window pops open much quicker if the application is still open.

    Using Keyboard Maestro I’m able to intercept the ⌘W that I do all the time (muscle memory), and turn that into a ⌘H.

  • Tech Tips

    Keyboard Maestro “Insert text by pasting” Quick Tip

    “Insert text by pasting” is faster than “Insert text by typing” (which is rarely necessary in my experience).

    Unfortunately, using the paste method results in unwanted junk in your clipboard (unless of course this is also your intention). You can insert by pasting without having it store the text into your clipboard by adding a “Delete Past Clipboard” action just after the insert. Despite the name of the action, this will only remove the last item from your clipboard (not the entire contents of the clipboard).

    Screenshot_2015-11-23_05-21-34

  • Tech Tips

    Automatic Dropshadow and Border on Mac OS X Screenshots

    If you’re like me, you take lots of screenshots. I probably average 20 a day. Primarily I use CMD-SHIFT-4 and drag a box around what I want to capture. The result is exactly what I highlighted. Here’s an example:

    Screenshot_2015-10-09_09-53-06_original

    That looks fine, except there’s nothing that really helps the image stand out. It’s not ready for blog posts, documentation, or wherever else you’d like to use an image. I’ve approached the problem a few different ways in the past, but I’ve finally settled on a Keyboard Maestro-based solution for “Automatic” processing of these screenshots. I also have created a “Drop shadow” Service so you can apply a dropshadow to any image by right-clicking and using the Services menu.

  • Tech Tips

    Keyboard Maestro – Looping Through Each Line of the Clipboard

    This graphic illustrates how you can loop through each line of the clipboard and use the line’s value for some purpose. It also demonstrates how to handle the first line differently than the others.

    This is zero-based. The second time through the loop will say “Line number 1” if you use the exact setup below. If you need your  i  variable to be “1” on the first loop, just move the  i + 1 calculation above the If All Conditions Met Execute Actions and change the  i is 0  to i is 1. Alternatively you could start i as 1 and change the i is 0  to i is 1.

    Screenshot_2015-09-06_07-17-17

  • Tech Tips

    Detecting When You’re “Away” or “Back” in Your Keyboard Maestro Macros

    Your Mac knows the last time you moved the mouse or pressed a keyboard key. We can use this information in Keyboard Maestro to perform actions based on whether we’ve “gone away” from or have “come back” to our computer. I’m using this technique to set my status in Slack to “Away” if I step away from my computer for more than 10 minutes, and back to “Active” when I return. Here are a few quick examples that could use this same basic framework:

    • Automatically pause music if I step away
    • Show me a “Welcome back!” message when I return
    • Write the date/time to a log file the when I go away and when I return

    Setup your macro with a “Periodically while logged in” trigger. In the example here I’m using 10 seconds because I want no more than 10 seconds to pass before my system detects that I’ve returned to my desk. The macro isn’t very CPU-hungry so 10 seconds shouldn’t be problematic.
    Screenshot_2015-07-28_07-52-16

  • Development,  Tech Tips

    Easy Dummy Text using Python Faker and Keyboard Maestro

    Yet again I’ve found a great use for Keyboard Maestro. I’m a web developer and often have to create “filler” or “dummy” text during development. In the past I’ve used Alfred workflows, copy-and-paste, browser extensions, and more. I’ve recently come up with a much cleaner (and more powerful) solution to achieving field-by-field or one-off dummy text.

    What do I mean by field-by-field and one-off? Well, I use tools sometimes to automate filling an entire form repeatedly (Fake, Selenium, iMacros, etc.). I’ve even written a Selenium extension to inject random text into the fields Selenium is automatically filling. Unfortunately, this all takes time. Sometimes I just need to fill some fields in a form a few times and move on. It’s not worth automating at that point. Enter Keyboard Maestro.

  • Development,  Tech Tips

    Keyboard Maestro URL Handler (KMLink) – Introduction and Basic Usage

    Keyboard Maestro offers many ways to trigger macros, but unfortunately there isn’t a URL handler that lets you trigger macros via a URL. There are a number of keyboardmaestro://  URLs handled by the built-in url scheme, but executing a macro isn’t an option. If you’re interested in triggering macros via bookmarklets and Finder shortcuts, read on…

    I’ve written a URL handler that allows you to execute macros and pass variables to them. It’s a simple app that registers a URL handler to process kmlink:// links.