Using Keyboard Maestro 6 to automate a web database
One of my favorite new features in Keyboard Maestro 6 is the ability to click on links in web pages using either Safari or Google Chrome.
This new feature let me make an old macro (which was based around trying to click in the right place) a lot more efficient. I'm going to show you how I set this up. Although you probably won't be using this same web database system, chances are good that you could encounter something similar to it. My hope is that this will help people who are unfamiliar with Keyboard Maestro (or macro programs in general) understand how they might use automation to help make their computing lives a little easier.
"What can't be automated?"
Every week I log into EBSCO, a web database of journal articles. I put in my search terms or follow links from TextWeek - another site which has indexed articles by topic and links to EBSCO. That takes me to a summary page for the journal article which gives me publication information. I go through the results and find the articles that I want to read.
There is no practical way to (usefully) automate that. I could probably find some way of fetching all of the results for a specific topic, but that wouldn't really be very useful. It's not exactly the stuff of summer blockbuster movies, but I rather enjoy it.
The automation part kicks in when I actually find something that I want to read.
Automate the tedious stuff
Once I find an article I want to read later I have two options:
I can click through and read the PDF through the site itself. This is invariably a lousy experience. The PDF ends up being loaded into one part of the screen, surrounded on three sides by parts of the website interface. I can save the PDF to my Downloads and/or open it in Preview, but it's all very clumsy and inefficient, as anyone who has used any sort of web database like this can attest.
I can email the PDF to myself. In fact, I can email the PDF to myself and get a copy of the bibliographic information including a link back to the original in case I ever need to find it again. That's much nicer.
Well, at least, theoretically. In practice, it's still fairly clumsy and inefficient. I have to click the "E-mail" link on the side of the page, as shown in the image below:
There's no keyboard shortcut for that link, of course, which means I have to use the mouse. Or do I? Actually, with Keyboard Maestro 6 I can assign a keyboard shortcut to clicking links, and so I have set ⌘ + Y ("Y" as in "Y"es I want to read this article, but also because the key combination wasn't in use by Safari).
When I press ⌘ + Y, Keyboard Maestro will click that link for me. But we're just getting started.
- my email address. Yes, every time. No, it never remembers it, no matter how many times I've typed it in before.
- A Subject: line for the email. You might think that the title of the article I am reading would be automatically filled into the Subject: field, but you would be mistaken.
- A checkbox for sending the bibliographic information in plain text instead of HTML.
You have probably already guessed that I'm not filling all of that in by hand, so you're probably expecting that I'm going to create another macro, right?
I don't need another macro, I can still use the one I've already created.
- Macro Step 1: "Click 'E-Mail' link"
- Macro Step 3: When that button appears, press Tab twice to get to the "Email to" field.
- Macro Step 4: Fill in my email address (remember this part later)
- Macro Step 5: Press Tab again and enter the Title of the Safari window (which Keyboard Maestro can easily do) into the Subject: field
- Macro Step 6: Press Tab two more times which will put me on the checkbox for 'Send in plain text format'
- Macro Step 7: press Space to toggle the checkbox
Which gives me something like this:
Let's look at those steps again. Are any of them difficult? No. But how many times would I accidentally make a typo in my email address? Or tedious would it be to keep copying and pasting the Title: into the Subject: field versus the 0.01 seconds it takes the computer to do it automatically? How many times would I accidentally paste the Subject: into the 'Comments' box? Or forget to check the 'Plain Text" box?
- Macro Step 8: click that "Send" button
Now we're done, right?
Aha, you're catching on. We're not quite done. After the email is sent, there's a confirmation window:
- Macro Step 9: Pause until the "Continue" button appears, then press it.
Now here's another little detail: sometimes I will open a bunch of tabs, and each tab is a different article, so when I am done, I want to close the tab because there is nothing more to do with it. However, other times I will click through from the search results and the article loads in that same page. If I close the tab there I will lose my search results and have to go back and start over again.
Fortunately, there is an easy solution.
- Macro Step 10: If Safari's menu option "History » Back" is enabled, select that menu option and take me back to the search results, but if that menu option is not enabled it means that this article was opened in its own tab.
Keyboard Maestro can do this easily. Just fill in the blanks:
How many times would I accidentally choose the wrong one? Knowing myself, a lot. Sure, it should be possible to just re-open the last tab, but it doesn't always work that way, especially when working with database queries.
If I was to do each of those steps myself, it would take about 20 seconds for each page, assuming that I never made a mistake. (Even that is cheating because I have a TextExpander macro for my email address.) It takes Keyboard Maestro between 2–3, and most of that time is actually waiting for the server-side actions to happen. This morning I found 15 articles that I wanted to read: 20 seconds times 15 articles is about 5 minutes.
To me there's a bigger factor than the time saved: the convenience. Having this process take just a few seconds instead of a few minutes means that I can keep my focus on what I am doing. That means more attention on the parts of the process that can't be automated: the searching and the reading. More time and energy to do the parts of the task that I want to do and enjoy, and less time and energy spent on the boring parts that the computer does faster and more precisely anyway.
One more thing... Maybe two...
Remember "Macro Step 4: Fill in my email address"? There's actually a 'trick' to that part too. Because I'm having the computer do the typing anyway, I actually have it send each article to two email addresses (separated by semi-colons, not commas... Why? You'd have to ask EBSCO). The first is my regular Gmail address where the article gets filtered away "just in case." The second email address is a SendToDropbox.com address which I specifically use for these kinds of articles.
I don't know what kind of black magic they are using over there at SendToDropbox, but by the time I have closed the tab or gone back to the previous page in Safari, Dropbox is already downloading the files that I have emailed to myself. SendToDropbox can automatically sort the files by date (which is handy since that will, effectively, group them by topic for me since I generally search for one topic per day).
Of course I can't stop there, so I have Hazel at that folder which does some even nerdier things to the files that SendToDropbox creates.
The point isn't to do what I have done...
As I said at the beginning, chances are you don't use the same database to lookup journal articles... But what do you do on a regular basis that could be automated? Are there parts of something that you do over and over again that you find really tedious that the computer could do for you?
These automation tools – Keyboard Maestro, Hazel, TextExpander – won't make you think that you are living with The Jetsons, but they can smooth out rough edges in your computing life, making it less frustrating and more enjoyable. That's why automation continues to be a big focus for me as I look for the "little things" that add up to a better experience using my Mac.
One of my favorite new features in Keyboard Maestro 6 is the ability to click on links in web pages using either Safari or Google...
Subscribe to Newsletter
Software Updatesmore updates
- Google Drive iOS app finally lets you sort items and find and replace in documents
- Viber announces Viber Out calls for iOS, goes head to head with Skype
- Amazon Cloud Drive Photos gains video, iPad support
- Pandora Radio 5.1: Wake up to your favorite station
- Microsoft revamps Bing for iPad
- Plex updated for iOS 7