Bunch and Timing.app

[Tweet]

I started this post a while ago, before I realized that Timing would be sponsoring the blog later this month. So full disclosure, Timing is sponsoring the blog later this month. This is a handy trick either way, so I’ll go ahead and post it as… value added?

Intro recap: Bunch is my little utility for batch launching apps and switching “contexts” as you work on your Mac. Timing is an excellent time tracking app for Mac that automatically keeps track of what you’re working on, helping you compile accurate reports of your time.

Aside from just launching apps, Bunch has features for running scripts and Automator Workflows. And Timing has an AppleScript dictionary that makes it easy to change the current “task” (a classification you can add to a time block). Thus, in a Bunch that launches a specific project context, you can use AppleScript to switch Timing over at the same time.

There are a few ways to do it, but the simplest is with raw AppleScript. At the top of the Bunch I use to switch to working on nvUltra, I have this:

* tell application "TimingHelper" to stop current task
* tell application "TimingHelper" to start task with title "nvUltra" project (project named "Development")

# When quitting the Bunch, stop current task
!* tell application "TimingHelper" to stop current task

The first line stops whatever task is currently being tracked. The second line sets the task to “nvUltra” and the project to “Development” (so as not to confuse it with the “Writing” nvUltra task).

The last line (!*) is only run when the Bunch is being closed. It will return Timing to general tracking without an assigned task.

If you want to get a little more reusable with this, you can create a shell script or Automator workflow and either pass arguments to it, or have logic that uses the $BUNCH environment variable to determine the task automatically. ($BUNCH is populated with the name of the Bunch in any script environments, and it shows up as a variable named “Bunch” for Automator workflows). I’m including a Workflow below that accepts a “task” and “project” variable when called from the Bunch, like this:

& workflows/Timing
- task = Bunch
- project = Development
!& workflows/Timing

Note that I have my Workflows stored in a subfolder (workflows) and that the .workflow extension is assumed by Bunch, so that’s not needed in the line that calls it.

It will automatically stop any running task before starting the one you pass. When it’s run without any arguments, as shown in the last line, it quits the current task and exits. Here’s what it looks like. If you’re interested in the actual AppleScript, just download below and open it in Automator.

You’ll see the variables named “task,” “project,” and “Bunch” present in the variables section of the Workflow. These must exist for Bunch to call it with the above parameters. (They also have to be empty for the “stop timing if there are no variables” thing to work.)

Timing.app Workflow for Bunch v1.0.0

An Automator Workflow for integrating Timing.app with your Bunches

Published 07/02/19.

Updated 07/02/19. Changelog

DonateMore info…

Don’t forget that Bunch also has its own (admittedly limited) AppleScript dictionary, so if you’re already scripting Timing from somewhere else, you can also launch a Bunch at the same time with a line like tell app "Bunch" to open "nvUltra" (to open the Bunch named “nvUltra”).

This is just one example of how Bunch can tie into other tools. For instance, you could use AppleScript to focus a specific project or tag in OmniFocus when switching to a relevant project with Bunch, or even read your todo items out loud while it launches the other tasks…

Have fun, and of course, check out Timing and see the Bunch project page for the latest documentation!