Check if timer is running

I have a Shortcut Automation to start a 1 hour timer and Do Not Disturb for one hour every time a particular app is run on my iPad. (Khan Academy for my daughter.)

the problem is that if she accidentally swipes out of the app and goes back in, the timer restarts to 1 hour. Is there a way to check to make sure a timer is not already running before setting the new timer?

I was thinking I could use Toolbox Pro to set a global variable when run the first time and check for the variable every time the automation runs, but how do I clear the variable when the time completes? So that may not work.

Consider disabling the gesture that she’s swiping out of the app with, or applying guided access mode and locking her into the app for that with a time limit on it.

Thank you. I’m trying to avoid those options if I can since she’s using my iPad and (1) I don’t want to disable the gesture for my use and (2) I want her to be able to get herself into the app without requiring me to turn on guided access manually first. I did try adding “Start Guided Access” as an action in the shortcut, but I got an error message when I ran it.

You might consider using my app Visual Task Timer. It includes Shortcuts actions for starting a new countdown and getting the current countdown time remaining and other status information. (You can also start and query it with an x-callback URL scheme if you’re old school.). It’s free in the App Store here:

And here’s a page explaining it’s automation features:

https://eheitfield.github.io/visual-task-timer-automation.html

-Erik

1 Like

Thanks, I will let you know if I can get it working the way I want.

I think I was able to get it working using your app. Here’s what the automation shortcut looks like:

And now I realize I probably didn’t need to set the variable. Hmm.

This is very cool! I spent a lot of time getting those Shortcuts actions to work properly; it’s nice to see someone (besides me) putting them to use!

This will sound weird, but this is my current workaround:

  1. Search for Calendar Event w/ the title of timer (limit 1 & sort most recent)
  2. If there is an event and the current time is between the start time and the end time; break out of shortcut
  3. Create Calendar Event
  4. Create Timer

Every time the app is open it runs, but only the first time does it run to the end.

I currently do this to set timers for instagram and gmail. With a few more rules you can also limit how many times per day/week/month.

Does this apply to Apple’s Timer app or ErikH’s Visual Task Timer?

I set this up to work with the existing timer, but you really don’t even need the timer itself. Basically what my workflow did was check if you’re currently in an appointment and if not then schedule one.

I also ended up checking to see if there was an appointment earlier that day so that I could limit exit out of the app if I had already been in it for the allotted time.