Time Tracking plugin

Hey there!

I recently started having to track time on a task + project basis. Was able to throw together a plugin for it, though I have messed around with a few things. I wanted timers to work across devices and to store the time elapsed in Estimated Duration. (reasoning for that included on the article I linked)

So timers are date stamps added to the notes section in a small attachment (Set up that notes section attachment as a library, not sure how good of an idea it is, but it adds generic fields to tasks, which is helpful.) and when you “stop” the timer, it just uses the difference between now and the timestamp.

Got some more info and the plugin file here:

2 Likes

Thank you @toish! I can start timers and refresh estimated durations, but I can’t stop them (action and menubar icon not available). Estimated durations are always 0minutes. I’m new to scripting, I can’t find potentially obvious solutions by looking among the plugin files. Any ideas? (My uneducated guess is it has to do with my Omnifocus being in French) Thanks!

Hi @ManunaM! The stop timer button first checks to see if there’s a file on the selected task called “db.json” (you should see it in the notes if you started a timer.) and then checks if it contains a timestamp. You should be able to double click on db.json in the note on a task with a running timer to see that. If you see db_1, it’s a known issue. I’m doing some non-standard stuff with attachments to make it work, so sometimes the plugin creates 2 different files. I found deleting both, restarting OmniFocus, and starting the timer fixes it. (Was something that only happens to me right after installing. I’m working on solving it!)

Currently I have it rounding down to the closest minute, so a timer stopped in under 1minute will become “0minutes” when added to the OmniFocus database.

(Feel free to reach out to me in French, I also have my OF database in French!)

Merci @toish. J’ignore si le forum fait des traductions automatiques, je vais donc continuer en anglais pour le bénéfice de tous.
Once I started a task, the db.json file looks like the screen captures below. My understanding is that there is no timestamp. Also, the file is db6 in this case, since I tried several times in various tasks (not sure if this relates to the issue you mentioned).

I also tried restarting the application, then my Mac in an attempt to magically solve the issue.
The issue seems to gravitate around adding the timestamp on start (?).

Ooh hmm, interesting, this does look like a bug! Could you screenshot the Plug In console?

It can be brought up here, under Automation > Show Console

Capture d’écran, le 2020-12-15 à 13.53.37

Then click Effacer to clear out anything that was already there, and select a task. If there’s a problem it should show some red text in the console.

So strange, all of a sudden it works!
First I had this message in the console, once I cleared it:

2020-12-15 at 4.02 PM

But then I selected a task and I can use the plugin. I don’t why, but the bug seems to have vanished. Looks promising!

Ah! Thanks for getting a screenshot, that is a bug! I think the reason this wasn’t working was the error occuring here never actually meant anything got returned when seeing if the button should be enabled or disabled.

I’ve corrected the issue in version 1.2! The update can be downloaded from the same spot: https://graypegg.com/posts/omnifocus-timer#installation Just double click the .omnijs file and omnifocus should ask if you’d like to update to 1.2.

Thanks so much again!

I had the same issue with the stop timer button using 1.2 and when I opened the OF automator console and cleared everything it also started working fine.