in applescript

OmniFocus script: Get total time of selected items

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.

Total Time.png

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.

Download it here.

For those with something to say:

Comment

18 Comments

  1. 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!

  2. 30mins…

    It seems that after 30min the script adds the 1h.

  3. 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

  4. 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.

  5. 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!

  6. 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. :)

  7. 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. :)

  8. 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.

  9. 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.

  10. 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

  11. 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!