Home

You’re Doing That Wrong is a journal of various successes and failures by Dan Sturm.

"Open on Which Mac" Shortcut

A few weeks ago, I started a new job. Along with that job came a new iMac and Touch Bar MacBook Pro. Having doubled the number of computers in my life, I quickly found that my frequently-used Open on Mac iOS Shortcut was not working as expected.

While at work, attempting to open a webpage on my iMac would result in...nothing. When I got home, I found the pages open and waiting for me on my personal iMac.

Prior to the newly acquired computers, I had never given much thought to why webpages opened on my iMac rather than my MacBook Pro. I spent 98% of my time on the iMac and, since it was doing what I wanted it to do, there was no reason to ask why. I mostly assumed it was because the MacBook Pro was asleep and the iMac is always awake.

As it turns out, the real reason webpages always opened on my personal iMac is because it has the fastest internet connection (a wired fiber connection) and would therefore download the Dropbox file containing the URL before any other computers had the chance. Hazel would then do its thing, trash the file, and that was that.

It had become necessary to modify my iOS Shortcut, allowing me to specify on which computer I wanted to open the webpage. To accomplish that goal, I added a "Choose from List" action to the shortcut where I could pick which computer to use. Then, I added short prefixes to the filename that represented each computer.

 
 

The original text file containing the page URL was called "URL-Current Date.txt". The new file names are:

  • The Touch Bar: tbr-URL-Current Date.txt
  • The New iMac: niM-URL-Current Date.txt
  • My MacBook Pro: mbp-URL-Current Date.txt
  • My iMac: diM-URL-Current Date.txt

Add a couple of "If" statements to the shortcut and we're about done. Here's what the new, much longer shortcut looks like.

 

These If statements are terrible and ugly and there’s got to be a better way to do this, but I don't know what it is.

 

After finishing the shortcut, all that was left to do was add the prefixes to the name search field in the Hazel rules running on each computer and call it done.

P.S. Thank you, again, to Jason Snell for fixing my very unsafe, poorly conceived version 1.0.