Ryan Jones

Copying URLs with Keyboard Maestro

Keyboard Maestro is such a huge app, that it’s almost impossible to know everything it can do, or when it updates to do it. I have been setting up a common shortcut in all the apps I use regularly, where I need a sharable URL or a url for putting in a note to access it quickly without searching. Today, I found a big boost to the reliability in that with some tokens.

I set up a shortcut for each app, only available in each app. This includes OmniFocus, Drafts, Mail, DEVONthink, and Safari.

I use ⌘ + shift + c for this common shortcut.


For Safari I used to have a cryptic fake key press shortcut to select the location bar, and copy to a clipboard, but now it is easy, with the Keyboard Maestro token %FrontBrowserURL%. It is now a single step Set System Clipboard to Text “%FrontBrowserURL%”.


Mail is more complicated and could break in a future update, since it utilizes AppleScript.

set urlText to {}

tell application "Mail" to if running then
  set selectedMessages to selection
  set theMessage to item 1 of selectedMessages
  set messageid to message id of theMessage
  set urlText to "message://" & "%3c" & messageid & "%3e"
end if

tell application "Keyboard Maestro Engine"
  setvariable "deeplink" to urlText
end tell

This script gets the currently selected email in Mail, and copies the resulting deep link to the system clipboard. Which essentially translates to something similar to message://%3cCAPemL8cVsN9ntPvFENSBvSH1paDvKDdQhTD+7UrsVmSs1JJrug@mail.gmail.com%3e with url encoded < and > elements. This will open Mail directly to the message.


In Drafts, I copy the Link which includes the UUID of the draft itself. I could do this without Keyboard Maestro, but it is nice to have it in one spot. This one is simple with Select “Link” in the Menu “File” in Drafts. This command in the menu can be found in the File menu > Copy > Link. And it is essentially activating that item.


Another menu selection for OmniFocus. This one is a little simpler though with it being Edit > Copy as Link.

Save Time & Download

All of these help me save time to not have to think about how to get links to follow up with items, or to share easily, with one simple shortcut in each app.

These are easy to build for yourself, but just in case, here is a download for the macros to import into Keyboard Maestro.

Download here