Run timed shortcut (Mac or iOS) in background/sleep mode

Maybe more of a Shortcuts question, but I have an action which resets a set of daily todos, which I’d like to run every morning at say 07:00.

I’ve made an “automation” on iOS (no corresponding feature on Mac) which to run the action at 07:00. Was hoping that this would happen behind the scenes while my phone was sleeping, but found that it instead just sends me a notification which I can tap to wake the phone, after which Drafts is automatically opened and the action is run. If the phone is already active, I think it swaps over to Drafts automatically without asking.

So all this is very much foreground actions, which can’t run without user interaction it seems. Is this correct, and a limitation of Shortcuts? Or am I missing something.

BR,
Ernst

You can’t run an in app action in Shortcuts on an iPhone when it is locked. I suspect you might be able to schedule then on the Mac - use your preferred scheduler utility (or a launchd plist definition) and the command line call for Shortcuts.

Thanks, as I suspected. Running my action via command line tool on Mac is a good idea, but still requires activity from me – starting my Mac (as I don’t think schedulers can work while Mac is asleep either).

Would ideally like something hosted like ifttt to run actions entirely independent of my devices, but this is not possible I realise.

What, exactly, are you trying to reset? Is this a draft you maintain a list in and rebuild it each day?

Perhaps, if you zoom out a little and explain what you are trying to accomplish we could suggest another way to approach it that would either (a) work with an automation of some sort or (b) not require the automation.

There is of course the option to temporarily rouse your Mac.

But, like Greg says, if you can outline your underlying requirement someone may be able to propose an alternate and more acceptable solution rather than just identifying limitations for your proposed approach.

Sure :slight_smile:

I have a list widget on my iOS homescreen which displays the title of all drafts tagged “homescreen”. This tag is applied to a set of tasks which I want to check off every day. For example one draft looks like this:

Do exercise 🍊

Another one:

Take vitamins 🍊

So, each draft is one task on a single line, and for fun I use “:tangerine:” as todo and “:green_apple:” as done. I have one action I run to mark the current draft as done (replace :tangerine: with :green_apple:). And then my daily “reset tasks” action does the reverse in one sweep: loop through all my task drafts by UUID and replace :green_apple: with :tangerine:.


I considered the scheduled wake up option @sylumer, but don’t think this will work when my Mac, which is a laptop, is asleep with the lid closed.

Ah yes, the seemingly never ending problem of a daily resetting task list, :relaxed:.

My first thought would be moving it to something like reminders and converting it to a daily repeating task with sub-tasks. that way you’d even maybe have a record of what you’d completed or not completed every day if you wanted that.

If you want to stay with Drafts, the first thing I’d probably do is create a pure Shortcut for it. That way, even if you do have to run it from a notification it’s not opening Drafts to run the action.

As for automating it, I’m not sure. As a primary iPad user I’ve literally turned screen lock off so I can run stuff like this in the middle of the night, :relaxed:. If you don’t want to do that, I’d look at the Mac side. It doesn’t use automations because I’m pretty sure there’s already a framework for it, Launch Control or something? Anyway, I’d do some research about that and waking up with the lid shut on a mac.

Thanks for your thoughts @yvonnezed.

I’ve been using the iOS automation which prompts me via notification every morning for a couple of days now, and think this actually works fine for me.

Creating a Shortcuts-only version is a good idea which would clean the flow up a bit. I’m curious if it would be possible to implement a “Run Drafts action in background” for Shortcuts, though I’d guess this is a limitation of iOS.

As for the record-keeping I actually have already implemented this in my “reset todos” Drafts action :slight_smile: