Maybe Shortcuts is great, but every single time I think, “This is a great use for Shortcuts!” I absolutely bang my head up against it for hours before failing. I write code every day, but I can’t make Shortcuts work.

I want to run an R script every week and email the results to someone. I can do this entirely within R with something like the gmailr package, but I thought I’d see what Shortcuts can do. There’s a really great “Run Script” Shortcuts action. Awesome– I setup what I want to do to run perfectly with Rscript path_to_my_R_file.R. It generates a file in the same working directory and pumps the fully specified file path to stdout. Now I want to grab that file path and use it to attach that file to an email and send it.

But… you can’t supply a text based file path (or at least I can’t) to any of the Finder actions and successfully find the file. And I can’t really figure out how to get Mail to see that file and add it as an attachment for the Send Mail action.

I didn’t even get up to the part where I try and say, “Run this Shortcut every Monday at 8am” and already I’ve given up. Back to cron/launchd and scripting my email in R.