Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jedimasterkyle

macrumors 6502a
Original poster
Sep 27, 2014
580
880
Idaho
Apologies if this is in the wrong place or has been asked before but I need help with figuring out a shortcut...

I'm trying to find a way to have a shortcut change focus after a timer runs out. Let me explain.

I have a shortcut called "Lunchtime" that basically starts a timer for 55 minutes, makes an entry in notes of the date and time I went to lunch and that's it. What I WANT it to do is this:

1. Start a timer for 55 minutes
2. Make an entry in notes of the date and time
3. Change focus to something different (mindfulness for example)
4. After the 55 minute timer ends, switch the focus BACK to what it was before (in this case, work)

Steps 1-3 are easy. It's step 4 that I cannot figure out and I'm not even sure it's possible.

I've played around with the "Ask for" prompt in shortcuts but that still requires that I manually input how many minutes to set the focus for and that's assuming it even works at all. All I need it to do is to change the focus when the timer starts and to change it when the timer ends. In theory, that shouldn't be hard but yet, here we are lol.
 

jedimasterkyle

macrumors 6502a
Original poster
Sep 27, 2014
580
880
Idaho
Trying setting up the different focuses using a different location for work and one for mindfulness. That should work provided those two locations are in different places.
Ordinarily, I would do it that way. But in this case, work and mindfulness are the same location (home) lol. Hence why I need it to be based on a timer.
 

NoBoMac

Moderator
Staff member
Jul 1, 2014
6,285
4,973
Can simply use the Set Focus action: until time (do the math, 55 minutes from now via Adjust Date). Then have an Automation for "when Focus turns off" to restore back to starting point.

Start Timer is pretty simple: for X minutes.

Switching back to previous Focus gets a bit tricky. There is a "Get Active Focus" action: call it, save it to a Note or in a file in Files app. When "focus turns off" runs, retrieve the save value and turn on that Focus.
 

Jessica Lares

macrumors G3
Oct 31, 2009
9,612
1,057
Near Dallas, Texas, USA
I think you can just have the Get Current Focus to begin with and select that in Set Focus without doing anything else. If that doesn't work, add Set Variable to it.
 
Last edited:

NoBoMac

Moderator
Staff member
Jul 1, 2014
6,285
4,973
Interesting idea, but have some concerns.

No such thing as global variables, so need to put a Wait action for X minutes otherwise Shortcut bombs out and loses the variable/value.

However, seem to recall that early versions of Shortcuts did have a timeout value if ran longer than X minutes, quit Shortcut. Have not tested in ages and not sure if Wait action has a similar limit in place, but something for OP to keep in mind/test.
 

jedimasterkyle

macrumors 6502a
Original poster
Sep 27, 2014
580
880
Idaho
Can simply use the Set Focus action: until time (do the math, 55 minutes from now via Adjust Date). Then have an Automation for "when Focus turns off" to restore back to starting point.

Start Timer is pretty simple: for X minutes.
So I tried this suggestion and received an error but I'm also not sure if I set it up correctly either lol. See attached.
 

Attachments

  • IMG_2957.jpg
    IMG_2957.jpg
    160.1 KB · Views: 123
  • IMG_2958.PNG
    IMG_2958.PNG
    365.6 KB · Views: 116

jedimasterkyle

macrumors 6502a
Original poster
Sep 27, 2014
580
880
Idaho
However, seem to recall that early versions of Shortcuts did have a timeout value if ran longer than X minutes, quit Shortcut. Have not tested in ages and not sure if Wait action has a similar limit in place, but something for OP to keep in mind/test.
I have tried the Wait action before with no success. Shortcuts cant understand why I would want to wait 3300 seconds (55 minutes) to run the next action so it just stops working and quits. That was one of the first things I tried but it basically laughed at me.
 

NoBoMac

Moderator
Staff member
Jul 1, 2014
6,285
4,973
"Until Time", not "Until Event Ends".

ADD: can kill a couple of birds with one stone when using "Event Ends". Create an event on the calendar ending 55 minutes from now and turn on Focus passing to "Until Event Ends" the Calendar entry. Add to the Calendar entry's note field the name of the old Focus that was in place. "When Focus turns Off" Automation runs, finds the Calendar entry, get the notes field to get old Focus name, turn on old Focus, delete the Calendar entry.
 
Last edited:

jedimasterkyle

macrumors 6502a
Original poster
Sep 27, 2014
580
880
Idaho
"Until Time", not "Until Event Ends".

ADD: can kill a couple of birds with one stone when using "Event Ends". Create an event on the calendar ending 55 minutes from now and turn on Focus passing to "Until Event Ends" the Calendar entry. Add to the Calendar entry's note field the name of the old Focus that was in place. "When Focus turns Off" Automation runs, finds the Calendar entry, get the notes field to get old Focus name, turn on old Focus, delete the Calendar entry.
I tried your first suggestion but didn’t see the edit you made. Here’s the error lol
 

Attachments

  • IMG_2959.jpeg
    IMG_2959.jpeg
    175.4 KB · Views: 151
  • IMG_2960.png
    IMG_2960.png
    361.3 KB · Views: 125

jedimasterkyle

macrumors 6502a
Original poster
Sep 27, 2014
580
880
Idaho
Need to use Adjusted Date, not Current Date in Mindfulness On.
I ran the shortcut earlier today and it worked perfectly! On top of that, I used your other suggestion of setting up a personal automation for when the timer is up and I need to switch the focus back. It works like a dream. Thank you for your help!
 
  • Like
Reactions: NoBoMac
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.