2017–04–23 Update: Fixes an issue that could cause the script to fail if certain top-level perspective separators are selected.
2011–07–06 Update: If you downloaded the script before 18 July 2011, there was a bug that could cause an additional hour to be added to the time. That issue is fixed in the current version.
Here’s a script to sum the total time of selected items in OmniFocus. Just select some items, fire it off and see how overcommitted you are.
Dan,
I’m really liking this script. Thanks for making it!
Thanks for the script. Just one problem: I just selected two actions, one of 30min and another of 10min … on Growl teh output is 1h 40min?! Where did this 1h come from?
Thanks!
30mins…
It seems that after 30min the script adds the 1h.
Ricardo—thanks for the bug report. Fixed!
Hi. Thanks so much for this script! I love it and use it regularly. I recently encountered a problem that I hope you can help with.
From the Perspectives menu, I chose “All Items.” The totals for all my tasks was 56 hours 21 minutes for 1027 items.
When I change it to be in context mode, I use the view bar to change it so that things are ungrouped AND availability is set to any status. This time when I run the script for the total time, it shows 56 hrs 21 minutes 886 items.
The time is the same – but not the number of items. Why would this be?
Thanks so much. Leila
Hi Leila,
The script will count all selected items (excluding the Grouping folders), including projects if they’re showing. So in your project view if you select the following:
Project
– Action 1
– Action 2
…the script will count three items. But switching to context mode, you may only see the actions, so that would be counted as two items.
Hope this helps.
Thanks for the explanation! Leila
I have never wanted to buy someone a beer more then I do right now. Thank you for making this gem! Review process just elevated to Über!
Thanks, Brian — glad you’re enjoying it!
Dan! I owe you a mint chocolate chip ice cream cone. Fantabulous script! Thanks so much for offering it up!
One issue: while I can run the script from the applescript editor (by hitting the play button after I select some actions in OF), I can’t do it from the installed script in the OF script folder.
Basically right now I’m a loser and I want to be a winner like you guys! :)
I followed these instructions to a tee: http://forums.omnigroup.com/showthread.php?t=7453
The script is in the right place (I think): ~/Library/Scripts/Applications/OmniFocus/Total Time.scpt
So when I click on the scripts menu bar icon, the script shows up as an OF script. I click that puppy, and my OF window flashes, but nothing happens.
Any ideas? I’m going to restart. If that fixes it, I’ll report back. :)
Just restarted. No bueno. I still get a flash then no report. Tried it with growl on and off. No notification whatsoever. I’m on OS X 10.6.8 & OF 1.10.3.
PS: “you’re at this website. i guarantee it.” -dan byler That? Brilliant. Am I buttering you up? Yes. But. It’s true. :)
This is amazing! I just installed it tonight and it still works perfectly! A couple comments: 1. in Omnifocus 2 goto help -> “Open Scripts Folder” 2. copy the script that location.
Most people might know this but it took me some time so I thought I would share the knowledge.
I get an error message. My Mac won’t even let me save this script, much less use it. I get error message -1,752 when I try to save it. I don’t know what that means.
Wow, love this!
Hi,
Very useful, thanks for sharing.
Is there any way to make it work even when the selection contains a top-level item “Today” or “Next week” etc. that appears when sorting by due? It gives an error when you just do “Cmd+A” and run the script on everything; you carefully have to de-select all the top-level “time items” first.
Best regards, Gandalf Saxe
Thanks for the bug report! I’ve updated the script to fix this.
Hi! This looks great, but I am a complete noob. How do I use this? I can download the folder, and I have dragged it into the scripts folder for OF2, but I don’t understand how to get it to do anything or make it show up to pull into the toolbar. I just have a folder that contains a bunch of script files… Any help would be much appreciated!
Hi Dominic, the easiest way to access scripts is to run them from your OmniFocus toolbar. Tim Stringer posted a nice walkthrough of the process.
Alternatively, you can also run them from any third-party tool that can execute scripts. If you’re interested in this approach, some good tools to check out include LaunchBar, Alfred, Keyboard Maestro, FastScripts, and the Mac’s built in Script Menu.
Hi Dan, Thank your for this great script. May I suggest that, beyond notification window, the script adds the total time info to the Estimated time of each active project. I think that would be of a great help. Best regards,
Thanks for the kind words, Paul.
As for your suggestion, I think I can see why it would be useful (OmniFocus doesn’t currently show project tallies, which was the impetus for creating the script in the first place).
Unfortunately, hardcoding the total as a project estimate would complicate things and have some adverse consequences. Say we start with
Project A: - Task A1 (5m) - Task A2 (5m)
Project B: – Task B1 (5m) – Task B2 (5m)
If you select all projects and run the script, you’ll see 20m total for these items. But if the script were to modify the projects…
Project A (10m): - Task A1 (5m) - Task A2 (5m)
Project B (10m): – Task B1 (5m) – Task B2 (5m)
…next time you run the script it would claim a total time of 40m. This could be addressed, of course:
There might be other solutions as well. But either way, it would add complexity and I’d need to think through it very carefully before trying something like that.
How to get the Apple Script Folder of OmniFocus. Go to help menu, there is one item with something “Show me Apple Script Folder”
The New Path is ( 16.01.18 ) ~/Library/Application Scripts/com.omnigroup.OmniFocus2.MacAppStore/HERE PUT YOUR SCRIPT
Now it is available at the Toolbar.
I’ve made extensive use of this script—thank you! I just updated to OF 3.0 for macOS, and also updated to macOS Mojave. I’ve copied Total Time.applescript to the OmniFocus 3 scripts folder and installed it on the toolbar. But when I run the script, I get the error message:
“./Library/Application Scripts/com.omnigroup.OmniFocus3/Total Time.applescript:1840:1847: execution error: The variable context is not defined. (-2753)”
Any suggestions for how to fix this? Thanks again.
Hello Dan,
thanks a lot for this Script. It worked well and nice in OmniFocus 2. Now i changed to OmniFocus 3. It got some changes on OF3, that the AS isn’t working on this version.
Cheers Chris
Thanks for this script, Dan! It’s become integral to my work flow.
This is great. Thanks so much Dan.
Hi Dan, Was pointed in this direction via a learnomnifocus.com live session with Joe Buhlig. However, I can’t make the script work. I get the below error message both when running it in OmniFocus or from FastScript. Any ideas to make i work?
The operation couldn’t be completed. /Users/fdx247/Library/Application Scripts/com.omnigroup.OmniFocus3/Total Time.applescript:1840:1847: execution error: The variable context is not defined. (-2753)
Hi Lars, you must be using an older version of the script that refers to “contexts”, which OmniFocus now calls “tags”. Options:
1) Open the script in Script Editor. Search and replace “context” with “tag” 2) Download an updated version of the script from https://github.com/dbyler/omnifocus-scripts
Cheers, Dan