This Week's Sponsor:

Whisper Memos

Turn Your Ramblings into Paragraphed Articles, Sent Right to Your Email Inbox

Automation April: Never Forget to Stop a Timery Time Tracking Timer Again

I’ve been using Timery to track my time using the Toggl time tracking service for several years now, and although I’ve gotten better at remembering to stop timers, I still forget sometimes. That’s why I built Stop Long Timer, a shortcut that periodically checks if you’ve had a timer running for a long time and volunteers to stop it. If you decline, Stop Long Timer offers to leave you alone for a while so you can wrap up whatever you’re doing.

Stopping a timer that’s been running for a certain period is the easy part. Timery has an action to check the duration of the current timer and another to stop a timer. What I wanted, though, is something more flexible because sometimes a timer has been running a long time because I’m deep in the middle of a project. In that case, I don’t want to stop the timer. In fact, I don’t want to be bugged again either. That part of Stop Long Timer is a little more complex and is a good example of how you can save data outside a shortcut to use as a reference point.

First, Stop Long Timer checks if the file LongTimer.txt exists, and if it doesn't, the shortcut creates it.

First, Stop Long Timer checks if the file LongTimer.txt exists, and if it doesn’t, the shortcut creates it.

Before we get to that, though, let’s start at the beginning. Stop Long Timer begins by saving the location of a folder called Long Timer and a file called LongTimer.txt as variables that will be used throughout the shortcut. Next, Stop Long Timer checks if the File variable has a value. If not, that means LongTimer.txt doesn’t exist, so the shortcut creates it with the current date and time as its contents.

With those setup actions out of the way, Stop Long Timer gets the text from LongTimer.txt formatted as a date and time and compares it to the current date and time. If the difference is negative, the shortcut stops. That may seem like an odd outcome at first, but I’ll get to why that check is necessary shortly.

Checking if long timer alerts have been deferred by the user.

Checking if long timer alerts have been deferred by the user.

Next, Stop Long Timer checks the duration of the current timer using Timery’s Check Current Time Entry action, saving it to the variable named Timer Duration. The shortcut defines another variable called Minimum Duration, which is the minimum time that must elapse before Stop Long Timer will offer to stop your timer. I’ve set Minimum Duration to four hours because I usually don’t work on one project for more than four hours in a single sitting, but you can set it to whatever fits best with the way you work.

If a timer has been running more than 4 hours, Stop Long Timer offers to stop it.

If a timer has been running more than 4 hours, Stop Long Timer offers to stop it.

The ‘if’ block that follows checks if the elapsed time of the current Timery timer is greater than the Minimum Duration, which is four hours by default. If the timer has been running longer, Stop Long Timer offers to end the current timer. If you answer yes, the shortcut stops, and the timer ends.

If you don't want to stop the timer, you've got the option to defer it 1-3 hours.

If you don’t want to stop the timer, you’ve got the option to defer it 1-3 hours.

If you answer ‘no,’ Stop Long Timer gives you a choice to extend your work time by 1, 2, or 3 hours before the shortcut will interrupt you again. This is where that check of the current time against the time logged in LongTimer.txt comes into play. If you defer Stop Long Timer’s interruptions, the shortcut adds the time you picked to the current time and saves it to LongTimer.txt. That way, each time Stop Long Timer runs and subtracts the future time from the current time, the result will be negative until the deferral time passes, and the shortcut will stop without alerting you that your timer has run over the limit you set.

Stop Long Timer stores the date and time in a plain text file in iCloud Drive, but you could use an app like Data Jar or other solutions instead. I chose a plain text file because I only needed to store a single piece of data, so other solutions felt like overkill under the circumstances.

Of course, for Stop Long Timer to work best, it should run automatically. After all, if you could remember to run the shortcut manually, you could just as easily stop any timers that were running instead.

Stop Long Timer works best coupled with a personal automation.

Stop Long Timer works best coupled with a personal automation.

I’m running Stop Long Timer as a personal automation with notifications turned off. Because I’ve set the shortcut up to only alert me to timers that have been running for at least four hours, My first timer check occurs mid-morning, which is the earliest that I’m likely to have had a timer running for four or more hours. I have personal automations check my timer every hour thereafter until around the time I typically go to bed. Because I’ve been using an iPad Pro in Universal Control mode most days, I’ve only set up personal automations on my iPad and not my iPhone or Mac. Also, because the Mac doesn’t have personal automations, I’d suggest running a dock applet version of Stop Long Timer from Calendar instead.

If you strip the time-checking logic out of Stop Long Timer, it’s a very simple shortcut. The way the shortcut uses an external data source to know when to alert the user to a long timer is a nice demonstration of how that technique can be used to enhance your shortcuts, but it also highlights how rudimentary the tools for running shortcuts on a schedule are. Until Shortcuts offers a solution, though, techniques like the plain text file used in Stop Long Timer and third-party apps like Data Jar are excellent solutions.

Stop Long Timer

Stop Long Timer is for Timery users who have a habit of letting their time tracking timers run long after they finish working. The shortcut, which works best when run as a personal automation on a regular schedule (I suggest every hour during your workday), will alert you when a timer has been running for more than 4 hours. You’re then given the option to stop the timer or defer any further alerts for 1-3 hours if you need more time.

Get the shortcut here.

Kolide: Endpoint Security Powered by People; Try for Free!

Unlock More with Club MacStories

Founded in 2015, Club MacStories has delivered exclusive content every week for over six years.

In that time, members have enjoyed nearly 400 weekly and monthly newsletters packed with more of your favorite MacStories writing as well as Club-only podcasts, eBooks, discounts on apps, icons, and services. Join today, and you’ll get everything new that we publish every week, plus access to our entire archive of back issues and downloadable perks.

The Club expanded in 2021 with Club MacStories+ and Club Premier. Club MacStories+ members enjoy even more exclusive stories, a vibrant Discord community, a rotating roster of app discounts, and more. And, with Club Premier, you get everything we offer at every Club level plus an extended, ad-free version of our podcast AppStories that is delivered early each week in high-bitrate audio.

Choose the Club plan that’s right for you:

  • Club MacStories: Weekly and monthly newsletters via email and the web that are brimming with app collections, tips, automation workflows, longform writing, a Club-only podcast, periodic giveaways, and more;
  • Club MacStories+: Everything that Club MacStories offers, plus exclusive content like Federico’s Automation Academy and John’s Macintosh Desktop Experience, a powerful web app for searching and exploring over 6 years of content and creating custom RSS feeds of Club content, an active Discord community, and a rotating collection of discounts, and more;
  • Club Premier: Everything in from our other plans and AppStories+, an extended version of our flagship podcast that’s delivered early, ad-free, and in high-bitrate audio.