Two whole days ago, I posted an updated version of my Open on Mac Shortcut. When I post my hacky automation tools online, the absolute best possible response I can hope for is being corrected by someone much smarter than I am.
Like when I posted v1 of the shortcut and Jason Snell pointed out that I had inadvertently created a way for anyone with access to my Dropbox account to execute arbitrary code on my computer. Which is a pretty bad thing, to be honest. Luckily, he modified the shortcut and posted a much better version on Six Colors.
When I posted v2 of my shortcut on Tuesday, in the caption for the (very long) shortcut image, I wrote:
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.
A few hours later, I received a lovely Twitter DM from Dr. Drang with the answer to my question.
To avoid the nested if statements, set up a dictionary with the Mac names as the keys and the file name prefixes as the values. Then assemble the file name by looking up from that dictionary after the Choose step.
— Dr. Drang, Famous Internet Snowman
The file name in the Destination Path of the Save File action is "
Current Date.txt. The shortcut is now much shorter, easier to understand, faster, and generally less bad.