This week's sponsor

Remote for Mac

Turn iPhone or iPad into remote control for your Mac

Posts tagged with "keyboard maestro"

Enhancing Reminders with AppleScript and Macros

As The Omni Group keeps working on OmniFocus 2 for Mac and Apple continues seeding new betas of iOS 7 and OS X Mavericks to developers, I have been reconsidering Reminders’ simplicity and enjoying the built-in iCloud sync, which, unlike other types of iCloud, is working fine for me. However, two things I miss from OmniFocus are the possibility to integrate the app with a web browser through bookmarklets and the system-wide Quick Entry panel; I use both tools on a daily basis to easily save a browser’s tab into OmniFocus’ Inbox, or to bring up a text field where I can jot down an idea and know that, no matter the app I’m using, it’ll be saved into OmniFocus. Luckily for me, Apple’s Reminders app comes with a good AppleScript Dictionary, which is likely something that Reminders’ core mainstream audience won’t ever care about, but that we can leverage to extend the app’s capabilities and input areas beyond Mountain Lion’s leather-and-paper window.

Read more

Automating Mail Signatures and Senders with AppleScript and Keyboard Maestro

Mail Keyboard Maestro

Mail Keyboard Maestro

I’m aware of the fact that it’s a common trend to call email a “nightmare” these days, but the truth is – email works for me. I have multiple addresses set up, I have my filters and smart folders to automate the process of filing and finding emails, and I’m enjoying the renewed interest of iOS developers in building email apps that solve old problems in new ways. But there is one thing I don’t like: Apple’s Mail app and how many clicks it takes to switch between configured accounts and signatures. As you can guess, I came up with a way to automate the process using AppleScript and (optionally) Keyboard Maestro.

I receive several messages every day to different email addresses, but I always want to reply with the same address and the same signature. Apple’s Mail app makes it easy to see all messages sent to all accounts with the unified Inbox, but it makes it surprisingly hard to set default accounts and signatures that should always be treated as, well, default ones. I don’t want to click on menus for accounts and signatures: I want to hit ⌘R and receive a new Reply window with the account and signature I want already set. Read more

Search For Rdio Lyrics with Keyboard Maestro



In spite of the existence of various Mac apps to display lyrics of a song that’s currently playing in iTunes or Rdio, I often find myself having to manually look them up through a web browser. It’s not uncommon to see a dedicated lyrics app being unable to fetch lyrics for a certain song, and, unsurprisingly, that always seems to happen when I’m in the mood for learning new lyrics. Having to Google lyrics and type a song’s name is a tedious process that ought to be automated, so that’s what I did. Read more

Quickly Append Browser URLs To Evernote with Keyboard Maestro

I often come across webpages and interesting links that I can’t check out right away, but that I also don’t want to send to Instapaper, Pinboard, or my OmniFocus inbox. They are, put simply, “stuff to check out”; I append these URLs to an Evernote note carrying the same name:



As I detailed in my review of Drafts 3.0 for iOS, appending text from an iPhone or iPad is easy with Agile Tortoise’s app and a combination of Evernote actions and browser bookmarklets, but I had to think of an equally straightforward workflow for the Mac. Unfortunately, the lack of a Drafts app for OS X forced me to resort to AppleScript to achieve the same kind of functionality, but the deal was (partially) sweetened by the new features introduced in Keyboard Maestro 6.0, released back in May.

Read more

Keyboard Maestro 6.0 Adds Syncing, Browser Actions, Device Triggers, And More

Keyboard Maestro 6

Keyboard Maestro 6

Long-time MacStories readers know how deep-seated Keyboard Maestro is in my OS X workflow. I use it every day, constantly, to automate my Mac to speed up writing, resize images, save PDFs, execute scripts, and more. Version 6.0 is out today and it brings over 100 new features. Unfortunately, I have only been playing with the app for a few hours, so an in-depth review will be published in the coming weeks.

Keyboard Maestro 6.0 retains the same interface and design principles of its predecessor while adding powerful new features that are exclusively built for Mountain Lion. For owners of multiple Macs, the good news is that Keyboard Maestro can now sync macros using Dropbox or any other sync service; in my initial tests, sync worked as advertised.

There are, of course, new triggers and actions to build macros that can automate (almost) any aspect of your Mac. You can now specify triggers for USB devices that are attached/detached to a computer, volumes, and wireless networks that your Mac connects to. This will be useful to build workflows (possibly to run at a specific time of the day) that handle backups or move files from one folder to another (the triggers can also be used as conditions in a macro). When you’re building a macro, you can now take advantage of a Macro Debugger that shows every action with completion status and breakpoints; this will come in handy to better understand why a macro isn’t working and, if so, how to fix it.

I’m personally excited to play around with the new actions for Safari and Google Chrome. As most of my workflows revolve around doing research in and grabbing text/URLs from a web browser, I have created dozens of macros that leverage AppleScript to store a webpage’s name and URL in variables to include in actions that output Markdown for my articles. With Keyboard Maestro’s new Safari and Chrome actions, you can eschew AppleScript entirely and let actions open and select tabs, get URLs and titles, submit and reset web forms, click links, wait until a browser has finished loading – while obviously accessing the same data as text tokens in your actions. On top of this, you can execute JavaScript in Safari and Chrome – which means activating bookmarklets from Keyboard Maestro with custom keyboard shortcuts is now easier than ever. I have already rewritten my actions for Markdown links to take advantage of the new browser actions; I have eliminated every instance of AppleScript, so there’s less manual saving to variables, the actions look more elegant, and I’m using built-in tokens.

There’s a lot of new stuff that I haven’t had time to properly test. You can now interact with styled text from Keyboard Maestro; you can write your own actions; there’s improved support for showing menus from installed apps (essentially enhanced GUI scripting); you can capture components of a regular expression by searching inside a variable or named clipboard – a power-user functionality that I am extremely curious to try with my regex to capture groups of Markdown inline links.

From what I’ve seen so far, Keyboard Maestro 6.0 doesn’t revolutionize the app but adds welcome (and needed) features such as syncing and browser actions while broadening its automation scope with intriguing new triggers, conditions, and actions. I look forward to seeing how I can update my macros to take advantage of the new functionalities introduced today.

Keyboard Maestro 6.0 is a paid upgrade. The app is available at $36, with an upgrade price of $25 for owners of the older version. A free trial of Keyboard Maestro 6.0 can be downloaded from Stairways Software’s website.

Launch Chrome Bookmarklets With Keyboard Shortcuts

A few weeks ago I switched back from Safari to Google Chrome. I wanted to give Safari a fair chance, especially after the introduction of iCloud Tabs, but, alas, the browser never "clicked" for me the way Chrome did. Worse, using Safari on a daily basis for work-related tasks became an unsafe bet, as it was crashing too often, taking several minutes to sync my iCloud Tabs, or generally hanging for no apparent reason. I'm still figuring out the ins and outs of Chrome -- particularly how to handle the lack of a "default browser" option on iOS -- but, so far, Chrome is working better for me.

One thing I miss from Safari is the ability to launch bookmarks in the Bookmarks Bar with a simple CMD+1...9 keyboard shortcut. I use a lot of bookmarklets (which, by the way, Chrome syncs faster than Safari across devices), and I'm too used to hitting CMD+2 for OmniFocus and CMD+4 for Pinboard to give up the convenience of quick bookmarklet activation. Unfortunately, Chrome uses Safari's CMD-based shortcuts for switching between open tabs.

The solution was laying in my dock the whole time. As cleverly shown by Patrick Welker, you can use a Keyboard Maestro macro to assign a keyboard shortcut to what is, essentially, Keyboard Maestro's own GUI scripting, only done with a visual workflow. Make sure to read Patrick's post to see how you can create a simple macro to "click" a bookmark in Google Chrome.

For the non-Keyboard Maestro users, a solution is to actually use AppleScript GUI scripting to simulate clicking a bookmark's name. Using something like the script below, you can use any launcher that supports assigning a keyboard shortcut to an AppleScript to quickly launch a Google Chrome bookmark.

tell application "System Events"
	tell process "Google Chrome"
		click menu item "pin" of menu "Bookmarks" of menu bar 1
	end tell
end tell

The script could use an error-checking system to see if Chrome is the frontmost application, but I avoided adding it because I know I won't use the shortcut anywhere else.

As for Chrome on iOS: because the browser forces you to type out bookmarklet names to launch them, my suggestion is to use a standard prefix so you'll be able to launch them easily from the iOS keyboard. For instance, I prepend "xx" to my most used bookmarklets, so Chrome for iOS will filter the names right away.

Andreas Zeitler’s Keyboard Maestro Macros Repo

Andreas Zeitler's Keyboard Maestro Macros Repo

A new collection of Keyboard Maestro macros by Andreas Zeitler:

Macros are meant to be imported “folder by folder”, rather than all at once. I’ve tried to make it more convenient for the user by putting all macros in a group labelled “Keyboard Maestro Macros Repo” before exporting. This way they are imported in a group of the same name, so that you can easier find them.

Note however: Some macros have very “commonly” used triggers like F1, ↑, or ↓. In these instances it is best to put the macros in a new group that is only available in one certain application, or a group that can be turned on and off by a separate shortcut. The window manipulation macros are an example of that. The triggers for moving a window by 1px in either direction is simply ↑, ↓, ←, and →. If not put in a new group you won’t be able to use these keys anymore.

Andreas is the creator of the Keyboard Maestro Markdown Library, which I use on a daily basis. In fact, I don't think I could ever come back to using a Mac -- or writing on my computer in general -- without the Keyboard Maestro Markdown Library, which is now part of the repo available on GitHub.

I'm already a big fan of several macros Andreas included in this new collection. I particularly appreciate the ones related to Mail: there's one to easily copy a message's unique URL, and another one to print a message as PDF with a single keystroke.

Get them here.


Convert URLs to Tweetbot Links

I communicate with my team through iMessage. We’ve tried many “communication services” over the years, yet, since last Fall, we’ve always come back to Apple’s solution. It’s not perfect for us, its reliability is far from 100%, but it works.

As we keep using iMessage every day, there’s one category of “media” we’re constantly sharing: Twitter URLs. We find some cool piece of information or news on Twitter, we share it with the team. Linking back to tweets has, in a way, become our favorite type of commentary for fun, news-hunting, and everything in between. URLs, though, aren’t the best way to jump back to a tweet, especially when you’re on a mobile device. When you’re on a Mac, clicking on a Twitter link will open a new browser tab, which doesn’t really bother us as we’re used to opening background tabs on our computers. But on the iPhone and iPad, it can become annoying: there’s a limit of 8 Safari tabs on the iPhone, you get yanked out of Messages, and, most of the time, URLs just don’t work. In our team chat, we’ve speculated the “Not Found” errors we’ve seen may be related to how Tweetbot generates Twitter URLs when you hit “Copy Link to Tweet”: instead of using status in the URL slug, it uses statuses, which seems to be the reason behind erroneous redirecting on mobile devices.

We’ve come to the conclusion that we want to be able to easily copy URLs and turn them into links based on Tweetbot’s URL scheme. Using a simple tweetbot:// URL, you can use Twitter’s status ID – the same you receive when you copy a link – to open a single tweet directly in Tweetbot. And the best part is, the same URL scheme works consistently across Tweetbot for iOS and Tweetbot for Mac. As everyone on the MacStories team is already using Tweetbot, the solution seemed obvious – plus: no more browser tabs.

The problem was finding a way to convert URLs easily, without having to remember complex combinations of keystrokes and commands. Furthermore, as I promised my team I’d come up with a way, I had to figure out a solution to do text conversion directly on iOS.

As a result, I’ve come up with an AppleScript, a Keyboard Maestro macro, and a simple Python script to transform Twitter URLs into their Tweetbot counterparts. Read more