Keyboard Maestro Blog Posts

December 1, 2021

Time Zone Convert

This past week I was scheduling a meeting with a counterpart in California. I was looking for an easy way to let them know the time of the meeting using Slack. I thought there would be some plug in to automatically display a time in EDT to other timezones.

There isn't a Slack tool. Instead of giving up, I decided to make a quick action in Keyboard Maestro.

TimeZone Convert Action

This macro is triggered via the status menu - since it's something that I don't use all the time. When I select the entry, a dialog box opens up and asks me to select the meeting time.

After I click 'OK' the output of the Macro will be sent to the clipboard.

Dialog Box

Meeting Time Dialog

After clicking 'ok' the following data is in the clipboard:

The meeting is at 4:00 PM EDT / 3:00 PM CDT / 1:00 PM PST

I can paste the clipboard data in Slack, Email, Facebook, or anyplace I need.

Keyboard Maestro Macro

This is what my macro looks like in Keyboard Maestro. I used the "Prompt for User Input" and "Execute Shell Script" actions.

Time Zone Converter

Python Shell Code

Provided here so you don't have to type in the information in the above screenshot

#!/usr/bin/env /usr/bin/python3
import datetime
import os
from datetime import datetime as dt, timedelta
from dateutil import relativedelta
kmTime=int(os.environ['KMVAR_Time'])
dt_object = dt.fromtimestamp(kmTime)
est = dt_object + relativedelta.relativedelta();
pst = dt_object + relativedelta.relativedelta(hours=-3);
cst = dt_object + relativedelta.relativedelta(hours=-1);
print(f'The meeting is at {est.strftime("%-I:%M %p")} EDT / {cst.strftime("%-I:%M %p")} CDT / {pst.strftime("%-I:%M %p")} PST')

Some Notes

I used Python instead of the built-in ICUDateTime function because it was a bit complicated to pass through a variable to the ICUDateTime function.

This Python shell script is a good example of how to pass Keyboard Maestro variables to Python.

I am sure the Python code could be cleaned up - just thought I share it in the basic form.

November 5, 2021

Keyboard Maestro 10

Keyboard Maestro 10 was released this week and it's packed with a lot of cool new features. You can find the complete list on Keyboard Maestro website.

The nice thing is that the developer is giving a discount for Keyboard Maestro 9 users. You can save $7 if you upgrade in the next 30-days. I would highly recommend getting the upgrade.

Three Features I am Excited About

Display in Menu Bar

Display in Menu bar allows you to make a Keyboard Maestro Group into it's own menu bar item. Now you can clean up the Keyboard Maestro menu by moving things out.

You can configure in what applications the menu bar appears. This way you don't have menu bar clutter in applications that won't use various macros.

You can only set Menu bar to real groups not smart groups.

Keyboard Maestro Menu Bar
Cool Trick here is to add your computer IP address to the menu bar.

Setting up the Group Menu bar:

  • Select a group on the left pane
  • In the far right pane, change "Do not display in menu bar" to "Display in Menu bar"

There's options to control what actually gets displayed - but that's for a later blog post.

Favorite Actions

Favorite Actions are a quick way to reuse common actions. Not only is the main part of the action in play, such as paste text, but also the various texts of that action. This is useful when you want to reuse certain actions over and over again.

One action that I have used multiple times is the "Set System Clipboard to Past Clipboard." I used this when I want to reset the clipboard content after running a macro.

Keyboard Maestro Favorties 2021
1. Select the Favorite in the Action category. 2. Available Actions. 3. How to add a Favorite.

To setup a favorite:

  • Open up a Macro.
  • Right click on an Action and click "Add to Favorite" (In the middle of the right click menu.)

To find all favorite actions:

  • Command Control A to open the Insert Action search box
  • Search for Favorite

Paste by Name Action

This allows me to paste clipboard history content that matches certain criteria. This would be equivalent to me opening up the Clipboard History Switcher tool and searching for something then pasting it in.

This would be useful when I want to paste the most recent Jira url in the clipboard.

Keyboard Maestro Paste By Name

Blog Posts

Check out some cool tips and tricks with Keyboard Maestro on my Keyboard Maestro Blog Posts.

February 26, 2019

Reset Clipboard History in Keyboard Maestro

Keyboard Maestro gives users a couple of options when adding a macro - the content can be typed or pasted in. If there's a lot of text to be inserted, pasting is the right way to go. Not only does the content get added faster, but there's less chance of accidentally typing a key when the macro is being inserted.

The downside to pasting is that the pasted content is now the most recent data in the clipboard. (Which isn't good if you want to do multiple things with the clipboard content.)

Thankfully Keyboard Maestro has a clipboard management functionality and you can easily roll back in one simple step; "Set System Clipboard to Past"

Adding Clipboard History

After I paste a content, I add the "Set System Clipboard to Past" to ignore the content being pasted in the clipboard:

Keyword Maestro Clipboard History

The advantage of doing this is that I can still use the clipboard content in another Macro or have access to the original content.

In the above example, I am pasting in a random phrase that I have setup for testing. The clipboard get's reset after the content gets pasted.

February 19, 2019

Hide Multiple Browsers Bookmarks

Sometimes I like to showcase how a website looks in Chrome and Firefox. I usually hide the Bookmark bar so that it's less distraction to the screenshot.

I made this process easier by creating a Keyboard Maestro macro to hide both browser's bookmark toolbars at the same time.

Using Keyboard Maestro, I set up a Macro so that I could close both Chrome and Firefox Bookmarks at the same time.

Keyboard Maestro Macro

Cross Brosser Bookmarks

Some Notes on the Macro

I used a weird keyboard combination to open/close the bookmark bar. If I need to do this a lot, I'll change up the shortcut to something a bit more reasonable.

When I execute the command a second time, both bookmark toolbars are visible.

I can easily change this to support other browsers, such as Omni, Safari and Maxthon.

The commands execute almost simultaneously and it doesn't matter which browser I have currently focused.

February 12, 2019

Adding Excel Date Shortcut Everywhere

If your a regular user of Excel you probably know the shortcut to add the current date to any field: Control ;

So, if your use to it, why not just make it a shortcut in any application.

Simple Shortcut

Here's is a simple way to add Excel 'Today's Date' feature using Keyboard Maestro.

Simple Date

Now when I need to add the date, I simply type in Control ;.

Advanced Technique

What if you need a different date format in different applications? For example, you may want to display today's date differently in Slack than in an Excel table.

There's a simple way to make this happen (This is what makes Keyboard Maestro a really cool application!) Simply put in a condition to check to see what is the current active application:

Advanced Date Maestro

I used PHP to do the formatting here because I wanted to add an English ordinal suffix (1st, 3rd)

I can add multiple applications checks by adding additional conditions to the statement. Which makes it easy to have a single action short cut to display different formats in applications.

February 5, 2019

Keyboard Maestro Keyboard Shortcut Enhancer

If your switching back and forth between applications, it can be hard to remember certain keyboard shortcuts. Apple has a UI Guidelines which standardize many common tasks: Cut/Paste/ Hide Applications.

What's nice about Keyboard Maestro is you can define short cuts when the application don't have functionality to do so.

Case in Point: I navigate between Apple Mail and Microsoft Outlook a lot. I wanted to have one keyboard shortcut to insert HTML links - since it's a command that I use a lot. Outlook uses Control Command K and Apple uses Command K.

With Keyboard Maestro, I can now remember only one shortcut between applications:

Outlook Quick Key

The above macro is in a group that is available only for Microsoft Outlook. This way it doesn't get activated in other applications. Come to think of it, it might be a good shortcut for BBEdit insert Anchor action.

August 28, 2018

Keyboard Maestro and LaunchBar Clipboard Management

Keyboard Maestro and LaunchBar have excellent activate clipboard history switcher. Having both of them enable allows you to get the best of both worlds when you need it.

Keyboard Maestro Advantage

  • You can keep the Clipboard History Switcher and mouse click what you need.
  • You can "pin" clipboard items so you won't loose them.
  • You can preview more of the images in the dialog box.

LaunchBar Advantage

  • Simple Interface, simply select the text and the dialog goes away.
  • Perfect for the quick clipboard history use.
  • ClipMerge - Press Command-C twice to merge the copied data with the latest clipboard content. Useful for list building.

Trick to have them Both Enabled

One trick to having multiple Clipboard management is to have a similar hotkey. This is the setup that I have for both:

  • Launch Bar: Command ∖
  • Keyboard Maestro: Shift Command ∖

Clipboard History Switcher
Settings in LaunchBar and in Keyboard Maestro.

This makes it easy to switch between the two functionalities and use the one that is perfect for me right now.

August 21, 2018

AppleScript iTerm2

iTerm2 is a popular Terminal replacement for Apple's Terminal application. It provides the ability to create profiles with unique text colors, window appearance and key mapping.

Here's a simple Keyboard Maestro Macro to open a new Terminal Session from any application.

KM Postgres

AppleScript Code

tell application "iTerm"
set myString to "echo -ne "033]0;"Database Server"007"" set newWindow to (create window with profile "Postgres Server") tell current session of newWindow write text myString end tell end tell

Why Have This Macro?

This comes in handy when I want to open up iTerm2 and go to a specific site..I don't have to open up iTerm2 and then switch to the profile and then select the profile.

August 14, 2018

MultiMarkdown Utility

I have been working with Markdown a lot lately. Trying to convert markdown to HTML has been a bit tricky. One solution that I found was MultiMarkdown. It's a command-line package that allows you to quickly convert markdown to HTML.

After playing with the tool for a while, I figured it's worth making a Keyboard Maestro Macro out of it.

Download the Latest MultiMarkdown Utility

To download the latest version of MMD and core tools, visit the GitHub project releases page, there is a MacOS https://github.com/fletcher/MultiMarkdown-6/releases

You can find additional information on using MultiMarkdown on http://fletcherpenney.net page.

Sample Macro in Keyboard Maestro

Here's a sample of the Macro that I have created to integrate with MultiMarkdown. The goal of this Macro is to take the Markdown content of the clipboard and convert it to HTML format.

KM Mark Down

Note: I am still working on ways to make this Macro better, I thought, for now, I should share what I have to help others.

August 7, 2018

Trigger Macro by Name

Trigger Macro by Name is an easy way to access your Macros. This is useful when you don't want to assign a keyboard shortcut because the action isn't used all the time. It's also a good way to execute a macro when you can't remember the trigger command.

Creating the Trigger Action

Trigger Macro by Name isn't enabled by default, you have to create a Macro to get this working.

  1. Create a new Macro, put it in the default Global Macro Group
  2. Create a useful trigger action, Keyboard Maestro recommends: Control Option Command T
  3. Insert the Trigger Macro by Name Action
  4. Save

Now when you use the Control Option Command T you'll be able to access any active Macro in Keyboard Maestro.

Trigger Action By Name

Cool Tip

Make the initial search as use:10m that way you'll have instant access to any macro when you trigger the command.