Is there an easy way to set a fixed amount of time in an automation?

I’ve tried several times to figure this out with no luck.

I have several different shortcuts that I only want to run for an hour, usually meetings or focus periods where I want DND turned on and then back off, as well as Timery timers. I realize I can have it prompt me for a length of time, and have some that do that, but it would be hugely useful if I could just build an hour into some shortcuts.

1 Like

There appear to be no timers in Shortcuts. Or anywhere else on iOS.

I want them for a different purpose: Creating a short delay - usually because a response could take a second or two.

I wonder, though, whether web browser javascript’s setTimeout(), which must surely be respected by Mobile Safari, could be commandeered for this purpose.

@timpowell

This will work for DND

I don’t use Timery so can’t help with setting that up.

@Martin_Packer

The Wait command seems to be what you need…

Or use Wait to Return if you are leaving the Shortcut to another app and then returning.

Hope this helps.

1 Like

Thanks! I was unaware of Wait and Wait to Return.

1 Like

Just a couple of notes on this…

  • The Wait action can also take a variable as input if you long press on the number of seconds (often easier than hitting the plus button multiple times).
  • While Wait and Wait To Return are good for short delays of a few seconds, they can’t really be used for longer delays if you want to leave the Shortcuts app as iOS seems to kill the Shortcut after a couple of minutes waiting.

An alternative approach for longer delays is to split the shortcut in two and use the Schedule Shortcut action provided by Pushcut at the end of the first shortcut to schedule the second. This does, however, require you to click on a notification so is only semi-automated.

Thanks. Splitting in two means, presumably, losing some information from the first part to the second part.

Yes, that’s right.

So to give a real world example, I have a Shortcut driven daily review that I do each morning that includes the following steps.

  • Open a custom planning perspective in OmniFocus where I can see what tasks are due today and flag others that I want to accomplish today with a “today” tag
  • Return to shortcuts, retrieve the tasks that are overdue, due today or flagged “today” and allow me to selectively add these to my calendar (I typically just schedule larger tasks that are due to take 30 mins or more)

I found that if I just put a Wait to Return after the first step, the shortcut would often have been killed before I returned to do the second.

So instead I moved the second set of actions to a separate Shortcut and used the Pushcut Schedule Shortcut action to run this a couple of minutes after I’d launched my OmniFocus planning perspective. This gives a notification that you can just tap on when you’re ready to run the second shortcut.

Not perfect, but it’s the best workaround I’ve found.

2 Likes

Is it possible you can share these?

Yes, happy to.

The first is relatively simple so I’ve just included a screenshot of the relevant section below.

I’ve shared the second at…

https://www.icloud.com/shortcuts/7bdf1ccce09b440e902fe1c6e8a2e08e

A few points to note on this…

  • It writes to a calendar named Tasks. You’ll need to change this (near the bottom of the shortcut) if you want to use a different calendar.
  • It schedules tasks to complete at their due time if due today or a default time of 4pm if not. I then go into a calendar app (I use Fantastical) to arrange these through the day.
  • It’s best to run the shortcut either from the Pushcut notification or the grid display within Shortcuts. If you run it from within the Shortcuts editor then there’s an annoying bug (in Shortcuts) that can cause it to crash when it hits the Choose from List action.

1 Like

Thanks for sharing, this is helpful. Could you briefly describe your plan perspective? Always looking for OF tips.

Thanks so much for the “add time” solution!

The wait solution I’ve seen, but it seem so tedious to put everything in seconds. Although today I did learn from @RogerDowning that it can be long-pressed, which takes some of the sting out.

1 Like

I suspect we’re drifting away from the original topic into an OmniFocus discussion here, but just to answer the question…

My Plan perspective is essentially a list of Due Soon and Available tasks, grouped and sorted by Due Date, however, there are a couple of refinements.

  • I use flags to indicate important tasks and the perspective is sorted by ”Due and Flagged" to bring these to the top of each date grouping
  • I use a “Later” tag to exclude tasks that are technically available, but that I’m not intending to work on this week and hence don’t want to see in my daily planning. I review the tasks with this tag as part of my weekly review and remove the tag from any I want to try to do in the next week. The perspective is constructed in such a way that if I forget to remove the Later tag from a task that becomes due then it will still show up.

The perspective configuration is shown below.

Thanks Roger, this is helpful.

i have a similar set up, but am always looking for tweeks that can improve it.

Lou

Apologies on reviving an old thread, but just wanted to mention a method I haven’t really seen mentioned anywhere. If you need something to happen later and want to split it up, but are worried about missing a notification from Pushcut (or that you’ll ignore it), you can trigger it to happen based on interacting with any apps. This works pretty well if you’re on your phone fairly often.

You can use the App Automation for when an app is opened (and/or closed) and select all the common apps that you use frequently, linking it to a shortcut called something like “On Opening Common App”. There’s also some shortcut features from the Actions app from Sindre Sorhus that are helpful like “Set global text variable” and “Get global text variable”. So you set the date/time you want the action to happen and your On Opening shortcut checks it and if you’re past the time specified, it clears the variable and does what it needs to do. You also can use this as a way to have something happen over and over after more than a given time interval as well, setting the variable to the last run date instead of clearing it. You could use multiple variables for multiple different actions.

I like to restrict certain apps using Freedom and had problems with the app timing out and not being able to enable the blocks automatically at night. So I use this method to force the app open every once in a while. So as soon as I open/switch to an app after a period, it’ll pop open Freedom by itself. I can swipe the bottom of the screen to get right back to the app I wanted to open but now Freedom was activated and will put in any blocks if it is time. Been also popping up my todo list every once in a while to get it more in my face, so I don’t forget to do stuff.