I shared an iOS Shortcut recently for opening academic journal articles via EZProxy. It’s a simple trick to short circuit the tedious cut and paste method . All it does is copy the EZproxy address 1 to the start of a url to give you access to resources via your own university library. Here are a couple of simple methods for doing the same thing using macOs automation tools.
Open Closed Access Journals with EZProxy and Keyboard Maestro
I am slowly coming to terms with some of the intricacies of macOS automation. Even so, I find Keyboard Maestro can be a little overwhelming at times. For one thing, it has a seriously misleading name, going well beyond the keyboard to hook into anything you could possibly want to do with macOs automation. The good news is you don’t have to be a coding grand master for it to be useful. This little macro is proof of that. Keyboard maestro can even simulate keystrokes, so using this method can even save you from hitting return.
Automate EZProxy with TextExpander
Built in Macros come standard with any decent text expansion app. I’m still using TextExpander, simply because there are no alternatives on iOS. As good as it is, the fact that I have Alfred on hand means TextExpander could probably be made redundant on macOS.
To make this work with TextExpander use the builtin macros to both grab the system clipboard macro and simulate keystrokes. My snippet looks like this:
Obviously, you need to copy the URL before you type the abbreviation so you’re a keystroke ahead with the Keyboard Maestro version, if that matters to you.
I already mentioned Alfred, which is easily as powerful as Keyboard Maestro. This would be a trivial problem to solve with Alfred, either by creating a workflow, or by using Alfred’s text expansion utility.
Another option is to use a clipboard manager. With Copied, for example, you can setup templates to transform the text you copy, and activate them with hotkeys. Similar functionality can be found in Pastebot. 2
Most university libraries, and some public libraries have an EZProxy address, it shouldn’t be too difficult to find one you can access. ↩
Unfortunately, neither app has been updated in a while, so I can’t vouch for their longevity. Copied is still working perfectly for me on macOS Mojave ↩
With the buzz around iOS Shortcuts, I thought it would be useful to do a round up of resources for sharing and discovering iOS Shortcuts, and for learning how to build your own. A number of galleries and exchanges have started to emerge in the past few weeks. Believe it or not, the app formerly known as Workflow was released back in 2014, so there are also a number of established resources worth knowing about.
This one looks very promising. The developer was clever enough to add an API, so users can incorporate actions to automate updates to complex Shortcuts. That feature alone should make RoutineHub the frontrunner.
This one was looking likely for about a week, until Routine Hub introduced its API. Still growing, just not as fast. They have started to run competitions for signups too, which puts me off to be honest. You may still find some interesting creations here
By all accounts, this was one of the first galleries. It was setup by users on the developer Beta, so they had a head start. Unfortunately, it is still locked down to new users, which means it is not as useful as other repositories at this point. There is some quality control, nonetheless the admins have missed an opportunity here by not trusting the community.
Anyone who has followed the Workflow/Shortcuts story will be aware of the role that Federico Viticci has played in popularising the app. More than that, MacStories has been a kind of vanguard of iOS Automation. In depth examples of advanced workflows and Shortcuts are shipped almost every week with Club MacStories. A membership will also grant you access to an impressive archive of Shortcuts.
I have my suspicions that Rose Orchard is not one person, but more like Inigo Montoya’s Dread Pirate Roberts. How else can you explain how she seems to be everywhere at once? This particular Orchard instance collates automation links. It has slowed down a little lately, but there is the Automators Podcast for would be automation disciples.
In the beginning there was Workflow which came with its own gallery. Once Apple acquired the app the gallery was one of the first things to be culled. Innovations like this one from Jordan Merrick help fill the gap for a time. I published a brief post about the directory, if you are so inclined. Otherwise, there is also plenty to learn on Jordan’s own site.
This site hasn't been updated in some time, but it still hosts a number of interesting workflows/Shortcuts that still work. I’m putting it here as it remains a little piece of Workflow and iOS Automation history.
Shortcuts for Students and Academic Nerds
There is a growing collection of Shortcuts on this very site. Some generic, and many more that are aimed at writing, research and study:
I recently shared an iOS Shortcut for scanning citations directly from the barcode of a book. Handy as it is, I have another shortcut I’m getting a lot of mileage from when I write on my Mac. Both Zotero, and Bookends1 can add references to your library directly by scanning different metadata, including any book’s ISBN. You can obviously search for the numbers, or type them out by hand, but this little trick can add items to your library by using an iOS device as a scanner.
The shortcut works by scanning the ISBN from a barcode of any book and copying it to the clipboard. If the Universal Clipboard is working properly, the ISBN will become immediately available on the nearest Mac to paste into Zotero, or Bookends. I have also set it to copy the number to my clipboard manager in case the universal clipboard fails, as it does far too often 2.
This version of shortcut is configured to use my favourite clipboard manager, Copied. You could also use the equally impressive Paste, which is included with Setapp. Or any other app with a URL scheme that uses iCloud sync, like Gladys or Yoink. You could even use Apples own Notes App in a pinch.
To supplement last week’s post on automatically mounting an external drive to create a clone, here is a quick tip for doing the same thing with an encrypted APFS volume. Ideally, you should be encrypting your backups. If you’re running macOS 10.13 High Sierra, or the impending macOS Mojave, then you will be cloning your system to an APFS volume. If that’s the case, you’ll need to no how to automatically unlock APFS volume with AppleScript.
Automatically unlock APFS volume with AppleScript
There is a little more work involved here, but none of it difficult. The file system might be new, but diskutil is still the command line program doing all the work managing volumes. There is simply a couple more commands involved. This assumes you have already encrypted the drive with Disk Utility.
To mount, or rather unlock an encrypted APFS volume with AppleScript, we need the following information:
APFS volume ID
Cryptographic user ID
The encryption password
The password is the same one you used when you formatted the drive. Here is how to get the other two pieces of the puzzle.
Find the APFS volume ID for your clone drive. You can see this information clearly in Disk Utility. For every volume listed there is a table of information, the device field has what you are looking for. It is some variation of disk1s1. Or if you prefer, with the drive already mounted you can run a terminal command to have the information of all your drives listed, like so:
diskutil apfs list
That command will take a moment, then print a whole lot of information to screen like below. Look for volume you intend to clone your system to and note down the APFS Volume Disk.
Once you have the volume ID. In the terminal run the following command (replace ‘apfs_volume_id’ with your disk)
diskutil apfs listcryptousers /dev/apfs_volume_id
You will get something that looks like this:
Type: Disk User
That long alphanumeric code is the Cryptographic user. Copy that code and you have everything you need to make your AppleScript work.
Create the AppleScript to automatically mount your encrypted APFS volume. The script looks like this:
do shell script "diskutil apfs unlockVolume [name_of_your_drive] -user B4BA200D-B0B7-4AB2-A48C-BDE9FFA7E3BA -passphrase [enter your passphrase here]"
Naturally, you will enter the name of your drive, and replace the user code with the one you copied above. Make sure you remove the square brackets.
Find a way to launch the script when you need it. There are a bunch of options in my previous post. My preferred option is currently Keyboard Maestro, but an Automator Calendar Alarm, or Lingon X work just as well.
Congratulations, you can automatically unlock an APFS volume with AppleScript.
I know some people find automation daunting. Fortunately, some of the most effective Mac automations are simple enough to get anybody started. The native MacOS automator app alone can save you from boring and repetitive tasks. Better still, Mac automation can save you from having to remember those tasks. A good example of a simple automation is how to automatically mount an external drive to create a bootable clone for backup.
Backup Strategies for macOS
The past 18 months we’ve had some hardware failures that took me from feeling over-prepared to being relieved I have this all set up. A solid backup and recovery scheme is table stakes for most nerds, but in my experience the same can’t be said of academics. To say nothing of the way most students wing it with their data. I’ve lost count of the horror stories I’m privy to. Undergrads losing devices, or having them pinched. Graduate students having to ask supervisors for a copy of their own thesis, or recompile dissertations from draft fragments. My backup strategy looks like this:
Regular time machine backups to an external drive on my Synology rt2600ac router. Setting up Time Machine to backup wirelessly is an overlooked example of Mac automation
Continuous offsite backup of everything to Backblaze. For US$5 a month, I have almost 6 terabytes of files backed up.
An automated, bootable clone of my entire system updated every night using SuperDuper!
If you have a solid backup strategy, regularly creating bootable clones of your whole system drive is no doubt part of it. If it isn’t, it should be.
Automatically Mounting an External Hard Drive
One of the problems with automating the creation of a bootable clone is the drive must be mounted. That might seem like I’m stating the bleeding obvious, or overlooking an obvious solution, but keeping a clone of your system mounted at all times can create all kinds of problems. Once the drive is indexed, you can have issues with document conflicts, messed up caching, and all manner of application weirdness. It doesn’t take much to launch the wrong version of an app, then you’re in a world of hurt.
The answer, of course, is to automatically mount the drive before backup, and eject it afterwards. But how to do that? Ejecting the drive is the easy part. Any decent backup, cloning app will have this functionality. This includes apps like Chronosync, Carbon Copy Cloner, or if you’re a Setapp user, Backup Pro. My favourite drive cloning software for Mac is Super Duper! for its elegant simplicity. Using Super Duper! to automatically eject the drive looks like this:
But, we are putting the cart in front of the horse. The question remains, how to automatically mount the drive. Thankfully, that is also simple. We can use a single command in AppleScript.
One Line AppleScript to Automatically Mount External Drive
A simple one line AppleScript to make a Mac automatically mount an external drive looks like this:
do shell script "diskutil mount clone"
To make it work you either name your drive ‘clone, or edit the script where it says ’clone’ with the name of the target volume. All that’s left is how to trigger the script. The more you start to peel back the layers on Mac automation, the more you realise how many different options there are. Here are three ways to run the above AppleScript, and automate the mounting of an external drive.
Automatically Mount External Drive with Automator Calendar Alarm
The first option is to use Automator, the native Mac app. Automator can utilise the Mac Calendar app to trigger simple MacOS automations with an alarm. Here's how to setup an Automator Calendar Alarm.
Open Automator from your applications
Choose Calendar Alarm
Search the actions on the left for ‘Run AppleScript’ and drag that action across to the workflow editor on the right — or double click
Clear the window and past our single line of AppleScript into the ‘Run AppleScript’ window. Here is that line of code again:
do shell script "diskutil mount clone"
Click on the little hammer icon to compile the script, then save the workflow and give it a name.
As soon as you save the workflow it will open the calendar app with a new entry. All you need to do is move it, and schedule it like you would any other event.
There is amore convoluted way to do this from the calendar itself, but the result is the same. I recommend building the workflow yourself, simple as it is. But if you’d rather, you can download a copy here
Automatically Mount External Drive with Keyboard Maestro
I would be happy using the Automator workflow above if I didn’t already use Keyboard Maestro. Setting up Keyboard Maestro to trigger the script is easier still. It’s not the kind of thing I suggest you purchase the app for, but the kind of simple use case it is often overlooked for.
Another option is to use Lingon X, a powerful automation utility that can launch practically anything. Lingon X is ideal for a job like this. To use Lingon you ned to save the script itself first.
Launch the native Mac Script Editor from Utiities
Paste the AppleScript into the editor do shell script "diskutil mount clone"
Compile with the little hammer
Save the script
Schedule a new job in Lingon X to run the script before your clone is set to run.
There is also an App Store version for Lingon available.
Choosing an External Hard Drive for Bootable Clone
The last word on this is doubled edged. You should of course try to be savvy about the external hard drives you buy, but this workflow wouldn’t exist if you could be certain you’ll never buy a lemon. I mentioned in my post on replacing the Apple Airport Extreme that Backblaze keep excellent drive statistics. Understandably, it doesn’t include the kind of portable external hard drives you will likely use for this kind of automated clone backup. I feel well covered with my setup, but I know plenty of people who like to rotate the drives and keep one offsite. Either way, I have always found Seagate Expansion drives to be fast, and reliable. Connected to a Hub, and stashed under the desk to avoid more clutter.
This came from a response to a fellow traveller in the Mac Power Users Facebook group. I was about to share the Automator action and Hazel rule that make up this little scheme when it dawned on me that this is a good opportunity to share a fairly straight forward workflow you can easily automate.
This is a fairly common need among students. Most good lecturers will share their presentations with you for their classes. Automating the filing of those slides is both, a good way to save a little time, and a way to ensure a consistent and reliable filing system. I don’t know about you, but my file management can get a little haphazard when done manually.
The situation is simple. Before or after class you are either sent, or given access to download a Powerpoint presentation with the slides for that particular lecture. However, you would rather have a PDF copy – or images as my MPU colleague prefers. There are a few ways you can come at this. If you simply want a PDF copy of the presentation, you can use Hazel to call an AppleScript and convert the file, rename and move it, and you’re done. If on the other hand you want images, you could do the conversion with an Automator workflow and simply add the ‘Render PDF as Images’ action to the end. Thereafter, it is a simple matter for Hazel to move the new file to wherever you want it. I tend to have it placed in my PDF Expert folder in iCloud, so I can markup the presentation on the iPad. Here is what the two versions of Hazel rules, and the Automator workflow look like:
If you want to build the Automator workflow yourself — and, there is no better way to learn how to use it — there are a couple of things to look out for. If you have any version of MS Office prior to 2016, you might be able to use the built-in automator action that looks like this:
Whether or not that will work for you is going to depend on the version of PowerPoint used to create the presentation. There appears to be some obscure bug with passing Office file names to Automator. As far as I can tell, MS Office no longer supports Automator directly, so you have a choice of hacking what you can from the 2011 actions or using AppleScript. Rather than messing around, trying to debug incompatible actions, AppleScript is your friend here. You can download the script itself here. It is also included in the Automator workflow, which you can download below, along with the Hazel rules. Happy Automating!
Picking up where I left off with the first Mac automation post; we covered some of the more well known Automation utilities on macOS in Text Expander, Automator, and Hazel. To be fair, at least one of the areas I cover this time around is likewise pretty well known, but I also want to highlight a couple of unique utilities that qualify as automation tools. These tools have both explicit and implicit utility for study, research, or indeed any academic related workflows. As with all such suggestions, the limit to what you can do with this kind of software will be somewhere between what you can dream up, and how much time you are willing (or able) to sink into them.
Popclip is one of those apps that highlights a gap in design reciprocity between iOS and macOS. We have always had the right-click  context menu to access functionality in OS X or macOS, but Popclip brings an interpretation of the context menu from iOS back to the Mac. The need to port contextual functionality such as copy and paste to the iPhone and iPad led to the creation of the ubiquitous black speech-bubble that appears from a long press on those devices. Popclip takes that idea, brings it to the Mac, and makes it extensible with customizable actions. I have become so used to using it that if ever I’m on a Mac without it I get a little lost. I use it for text transformations , Shortening URLs, dictionary and thesaurus lookups, adding tasks to my task manager, adding links to Pinboard or Instapaper, adding references to Papers, translations, and the list just keeps going. This link will take you to the pre-packaged extensions that are available, but the good news doesn’t end there. Not only will a Github search reveal many more ingenious uses for Popclip, and you can even code your own. To get you started with customization, check out Brett Terpstra’s Popclip Extension Generator
Alfred, Launchbar and others (…but mostly Alfred)
A lot of Mac nerds would argue that a Launcher is the purist’s starting point for workflow automation. If you want to keep your hands on the keyboard, then using a launcher is essential. Spotlight has developed well beyond its basic search capabilities in the past few years to the point where, although still relatively basic, it is much more than a mere search engine and application launcher nowadays. What’s more, Spotlight comes baked right into macOS, so a lot of people will find that hitting command (⌘) space will allow you to do a lot more with the keyboard than you realised.
Going beyond Spotlight to incorporate automation is where the best third-party launchers excel. As far as which launcher is the best? That honestly depends on who you talk to, but there seems to be a fairly solid consensus that the contenders are LaunchBar, and my personal favourite Alfred.
Both LaunchBar and Alfred are limitlessly extensible; LaunchBar with Actions and Alfred with Workflows. It is difficult to say how one might choose between them , but you may find the keystrokes for one, or the other, more intuitive for the way you work. Other than that admittedly abstract and vague selection criteria , it is fair to say the user community around Alfred appears much more engaged and accessible. Both the official site and forum, and the unofficial Packal site, are loaded with workflows, advice and friendly automation ninjas willing to help you down a rabbit hole, or back out of one.
Again, I use Alfred for all kinds of things. The screenshot of my workflows is only part of the picture. Searching my Papers library, converting documents with Pandoc, searching my Pinboard bookmarks, making currency conversions, task management input, natural-language entry of calendar events, time-stamping notes, Image Optimisation, file management. Alfred is an onion, and in reality I have barely peeled back the first layer. There is a built-in clipboard manager, and text-expander style snippet function. Anything that you can automate via scripting can be triggered via a launcher like Alfred or LaunchBar, which means they capable of all kinds of complicated tasks. As a bonus, they can manage the simple things too, I even lock, logoff and shutdown my Mac with Alfred – and Alfred also has an iOS remote app that allows me to control my Mac from my iPhone or iPad.
These are not the only two apps of this kind, of course. There are die-hards still using the OG launcher, Quicksilver, and given it is open source and free, for some it remains worth a look. Another old favourite of long-time Mac users is Butler, from Many Tricks. There is the lightweight Launcher from Nulana, which is reknown for its advanced calculator and script launcher. Finally, a couple I feel are worth keeping an eye on, the open sauce Zazu App that bills itself as an extensible launcher for ‘hackers, creators and dabblers’, and perhaps the most interesting new app in tis area Lacona, a natural language launcher built on Node.js that already has web automation triggers through IFTTT. 
Dropzone is another extensible utility that can thread automation actions into your workflow. Another example of an app that is incredibly useful even in its most basic use cases, or can be bent to one’s will with a little ingenuity. The basic premise is very simple, Dropzone is a menu bar app that extends the drag and drop capabilities of your Mac, it houses destinations and automation actions on the ‘drop zone’. You can use it to hold, copy or move files between apps , configure it to upload files to cloud services or an FTP server, or social media sites. The real power of the app lies in the customisable actions – I have scripts for renaming files, stripping formatting from text, making animated GIFs, shortening URLs, and so on – but Dropzone also makes for an excellent conduit to other parts of your system. For example, as part of my workflow for posting images to this site I will take a screen shot and drag it to the images folder configured in Dropzone, from there Hazel will invoke an Automator workflow  to resize the image, then pass the file to ImageOptim for compression and removal of personal metadata. I could easily automate the whole process, but I don’t want every single screenshot I take sent to the same place, so Dropzone allows me to have a little more control over the file picking.
Or option-click for you die hard, old-school Apple nerds ↩
Such as capitalisation, Sentence-case for formatting titles, clearing formatting, hyphenating etc ↩
Some people solve this by using them both, but I’m yet to find something I need LaunchBar for that I can’t do with Alfred ↩
And the fact the Alfred’s developers have a commendably irreverent name Running with Crayons ↩