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 ↩
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.